<template>
  <Spin :spinning="loading" tip="Loading...">
    <div>
      <!-- table -->
      <BreakSpace label="工单及车辆信息" :containerStyle="{ marginBottom: '10px' }" />
      <FormPanel ref="formPanel1" :list="formList" :cols="4" :formType="'add'" labelWidth="110" :isSubmitBtn="false" @formChange="formChangeHandle" />

      <BaseDialog :visible.sync="weixiugongdan" :title="'维修工单选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <SelectWeiXiuGongDan @close="weixiugongdanClose" @save="weixiugongdanSave"></SelectWeiXiuGongDan>
      </BaseDialog>
      <BaseDialog :visible.sync="zhusunjian" :title="'主损件选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <Selectzhusunjian @close="zhusunjianClose" @save="zhusunjianSave"></Selectzhusunjian>
      </BaseDialog>
      <BaseDialog :visible.sync="guzhangxianxiangdaima" :title="'故障现象选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <Selectguzhangxianxiang @close="guzhangxianxiangdaimanClose" @save="guzhangxianxiangdaimaSave"></Selectguzhangxianxiang>
      </BaseDialog>
      <BaseDialog :visible.sync="guzhangyuanyin" :title="'故障原因选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <Selectguzhangyuanyin @close="guzhangyuanyinClose" @save="guzhangyuanyinSave"></Selectguzhangyuanyin>
      </BaseDialog>
      <BaseDialog :visible.sync="zifeigongdan" :title="'自费工单选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <Selectzifeigongdan @close="zifeigongdanClose" @save="zifeigongdanSave" :rowDate="rowDate"></Selectzifeigongdan>
      </BaseDialog>
      <BaseDialog :visible.sync="weixiuxiangmulistaddflag" :title="'维修项目列表新增'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <Weixiuxiangmulist @close="weixiuxiangmulistClose" @save="weixiuxiangmulistSave2" :finalLabourList="finalLabourList"></Weixiuxiangmulist>
      </BaseDialog>
      <BaseDialog
        :visible.sync="peijianhuanshangjianlistaddflag"
        :title="'备件换上件列表新增'"
        destroyOnClose
        :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }"
      >
        <Peijianhuanshangjianlist @close="peijianhuanshangjianClose" @save="peijianhuanshangjianSave2" :finalPartRList="finalPartRList"></Peijianhuanshangjianlist>
      </BaseDialog>
      <BaseDialog :visible.sync="fujiaxiangmulistaddflag" :title="'附加项目列表新增'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <fujiaxiangmulist @close="fujiaxiangmuClose" @save="fujiaxiangmuSave"></fujiaxiangmulist>
      </BaseDialog>
      <BaseDialog :visible.sync="peijianhuanxiajianlistaddflag" :title="'备件换下件列表新增'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <PartSelect @close="peijianhuanxiajianClose" @save="peijianhuanxiajianSave5"></PartSelect>
      </BaseDialog>
      <BaseDialog :visible.sync="peijianhuanxiajianlistchangeflag" :title="'备件换下件列表新增'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <PeiJianSelect @close="peijianhuanxiajianClose" @save="peijianhuanxiajianSave"></PeiJianSelect>
      </BaseDialog>
      <BaseDialog :visible.sync="yushouquan" :title="'预授权单号选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <yushouquan @close="yushouquanClose" @save="yushouquanSave" :data = "dataVin"></yushouquan>
      </BaseDialog>
      <BaseDialog :visible.sync="jiuyuandanhao" :title="'救援单号选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <jiuyuandanhao @close="jiuyuandanhaoClose" @save="jiuyuandanhaoSave" :helpVin="helpVin"></jiuyuandanhao>
      </BaseDialog>
      <Drawer :visible.sync="actions.visible" :title="actions.title" width="70%" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <addDialog :type="actions.type" :row="formData" @close="close" />
      </Drawer>
      <BaseDialog :visible.sync="suppliers" :title="'供应商选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <SupplierList @close="suppliersClose" @save="suppliersSave" :rowDate="rowDate"></SupplierList>
      </BaseDialog>
      <BaseDialog :visible.sync="reportFlag" :title="'质量报告单选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <SelectReportNo @close="reportClose" @save="reportSave"></SelectReportNo>
      </BaseDialog>
      <BaseDialog :visible.sync="batchActivities" :title="'批量活动选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <BatchActivities @close="batchActivitiesClose" @save="batchActivitiesSave" :rowDate="rowDate"></BatchActivities>
      </BaseDialog>
      <BaseDialog :visible.sync="isvideo" :title="'视频预览'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <videos @close="dealercloseHandler" :src="src" />
      </BaseDialog>
      <BreakSpace label="索赔信息" :containerStyle="{ marginBottom: '10px' }" />
      <FormPanel ref="formPanel2" :list="formList1" :cols="4" :formType="'add'" labelWidth="130" :isSubmitBtn="false" @formChange="formChangeHandleSp" />
      <BreakSpace label="上传视频/压缩文件" :containerStyle="{ marginBottom: '10px' }" />
      <Spin :spinning="loading" tip="Loading...">
        <UploadFile
          v-if="1 === 1"
          :action-url='`${uploadPrefix}/api/file/oss/upload`'
          :initial-value="form.fileList"
          :fileTypes="['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'pdf', 'rar', 'zip', 'mp4', 'avi', 'rmvb', 'WMV', 'ins', 'inr']"
          :fileSize="100"
          :isOnlyButton="true"
          :limit="10000"
          @change="successHandler"
          >上传附件</UploadFile
        >
        <FilterTable
          ref="fileTable"
          :columns="columnsFile"
          columnsRef="whbydUploadFile"
          :isSelectColumn="false"
          :onColumnsChange="columnsFile => (this.columnsFile = columnsFile)"
          height="auto"
          :dataSource="list"
        />
      </Spin>
      <BreakSpace label="维修项目列表" :containerStyle="{ marginBottom: '10px' }" />
      <FilterTable
        ref="table"
        :columns="columns"
        :params="fetchParams"
        :dataSource="dataList"
        :datakey="'items'"
        :onColumnsChange="columns => (this.columns = columns)"
        :onRowSelectChange="selectChange"
        selectionType="single"
        :isSelectColumn="false"
        :isPagination="false"
        height="auto"
      >
        <!-- 维修项目列表新增 -->
        <template slot="controls" slot-scope="props">
          <multiuse-button size="small" type="primary" icon="el-icon-plus" @click="weixiuxiangmulistadd()" :disabled="flag">添加</multiuse-button>
        </template>
      </FilterTable>
      <div style="margin-bottom: 1rem"></div>
      <BreakSpace label="备件换上件列表" :containerStyle="{ marginBottom: '10px' }" />
      <FilterTable
        ref="table1"
        :columns="columns1"
        :params="fetchParams"
        :dataSource="dataList1"
        :datakey="'items'"
        :onColumnsChange="columns1 => (this.columns1 = columns1)"
        :onRowSelectChange="selectChange"
        selectionType="single"
        :isSelectColumn="false"
        :isPagination="false"
        height="auto"
        :onCellChange="changeCells"
      >
        <template slot="controls" slot-scope="props">
          <multiuse-button size="small" type="primary" icon="el-icon-plus" @click="peijianhuanshangjianadd()" :disabled="flag">添加</multiuse-button>
        </template>
      </FilterTable>
      <BreakSpace label="备件换下件列表" :containerStyle="{ marginBottom: '10px' }" />
      <FilterTable
        ref="table2"
        :columns="columnshuanxiajian"
        :params="fetchParams"
        :dataSource="huanxiajiandataList"
        :datakey="'items'"
        :onColumnsChange="columnshuanxiajian => (this.columnshuanxiajian = columnshuanxiajian)"
        :onRowSelectChange="selectChange"
        selectionType="single"
        :isSelectColumn="false"
        :isPagination="false"
        height="auto"
      >
        <template slot="controls" slot-scope="props">
          <span :style="{ padding: '10px 20px',display:inline-block}" v-if="appId == 'arcfox'|| addFlag"><multiuse-button size="small" type="primary" icon="el-icon-plus" @click="peijianhuanxiajianadd()">添加</multiuse-button></span>
        </template>
      </FilterTable>
      <BreakSpace label="附加项目列表" :containerStyle="{ marginBottom: '10px' }" />
      <FilterTable
        ref="table3"
        :columns="columnsfujiaxiangmu"
        :params="fetchParams"
        :dataSource="fujiaxiangmudataList"
        :datakey="'items'"
        :onColumnsChange="columnsfujiaxiangmu => (this.columnsfujiaxiangmu = columnsfujiaxiangmu)"
        :onRowSelectChange="selectChange"
        selectionType="single"
        :isSelectColumn="false"
        :isPagination="false"
        height="auto"
        :onCellChange="changeCells1"
      >
        <template slot="controls" slot-scope="props">
          <!--        <multiuse-button size="small" type="primary" icon="el-icon-plus" @click="fujiaxiangmuadd()">添加</multiuse-button>-->
        </template>
      </FilterTable>
      <BreakSpace label="外出救援信息" :containerStyle="{ marginBottom: '10px' }" />
      <FormPanel ref="formPanelOut" :list="outformList" :cols="5" :formType="'add'" labelWidth="110" @formChange="formChangeHandleOut" :isSubmitBtn="false" />
      <BreakSpace label="外出救援费用" :containerStyle="{ marginBottom: '10px' }" />
      <FormPanel ref="formPanelOutAmount" :list="outAmountformList" :cols="5" :formType="'add'" labelWidth="110" @formChange="formChangeHandleOutAmount" :isSubmitBtn="false" />

      <BreakSpace label="费用信息" :containerStyle="{ marginBottom: '10px' }" />
      <FormPanel ref="formPanel3" :list="feiyongformList" :cols="4" :formType="'add'" labelWidth="110" @formChange="formChangeHandle2" :isSubmitBtn="false" />
      <LazyLoadTab v-model="activeName" :tabMenus="menus" :destroyOnClose="true"></LazyLoadTab>
      <div style="padding-top: 3rem"></div>
      <div style="padding-top: 3rem"></div>
      <div
        :style="{
          position: 'fixed',
          left: 0,
          bottom: 0,
          right: 0,
          zIndex: 9,
          borderTop: '1px solid #e9e9e9',
          padding: '10px 20px',
          background: '#fff',
          textAlign: 'right'
        }"
      >
        <multiuse-button type="primary" :click="zuofei.bind()">作 废</multiuse-button>
        <multiuse-button type="primary" :click="saveDialog.bind()">保 存</multiuse-button>
        <multiuse-button type="primary" :click="submit.bind()">提 交</multiuse-button>
        <multiuse-button @click="closeDialog">关 闭</multiuse-button>
        <BaseDialog :title="'上传附件'" :visible.sync="upVisible" destroyOnClose>
          <uploadFile :rowData="uploadDate" @close="upVisible = false" @save="saveFile"></uploadFile>
        </BaseDialog>
      </div>
    </div>
  </Spin>
</template>
<script>
import { getToken, getUserId, getOwnerCode, removeDataType, getAppId, removeAppId } from '@/assets/js/auth';
import SelectWeiXiuGongDan from '@/pages/claimDemage/tools/SelectWeiXiuGongDan.vue';
import Selectzhusunjian from '@/pages/claimDemage/tools/vehicle.vue';
import Selectguzhangxianxiang from './Selectguzhangxianxiang.vue';
import Selectguzhangyuanyin from './Selectguzhangyuanyin.vue';
import Selectzifeigongdan from '@/pages/claimDemage/tools/Selectzifeigongdan.vue';
import Weixiuxiangmulist from './Weixiuxiangmulist.vue';
import Peijianhuanshangjianlist from './Peijianhuanshangjianlist.vue';
import Peijianhuanxiajianlist from './Peijianhuanxiajianlist.vue';
import yushouquan from './yushouquan.vue';
import jiuyuandanhao from './jiuyuandanhao.vue';
import SelectReportNo from './SelectReportNo.vue';
import fujiaxiangmulist from '@/pages/claimDemage/tools/fujiaxiangmulist.vue';
import { newSave, quySP, getRoById, editSave, queryRepairDetail, queryPreClaimLog, cmsClaimTypeStr, queryModelDetail, getCliamPart,getSysName1List,getSysName2List,getSysName3List,getSysName4List,getFaultName} from '@/api/claim/dealer/ClaimApplication/index';
import { isFormEmpty } from '@/utils/index';
import SupplierList from '@/pages/claimDemage/tools/SuppliersList.vue';
import BatchActivities from '@/pages/claimDemage/tools/BatchActivities.vue';
import { translateByVinAndModelCode } from '@/api/claim/dealer/AuthApplication';
import PeiJianSelect from '@/pages/claimDemage/tools/vehicle.vue';
import PartSelect from '@/pages/claimDemage/tools/vehiclePart.vue';
import { saveRescue, getResultList } from '@/api/repair/repairBusiness/rescueService/index';
import addDialog from './addDialog.vue';
import videos from '@/pages/claimDemage/BasicData/AuthApplication/videos.vue';
import moment from 'moment';
import uploadFile from './uploadFile.vue';
import { selectByParaCode } from '@/api/claim/factory/SystemParameterMaintain';
import { getSupplierList } from '@/api/dictionary';
import { dictionary } from '@/utils/dictMixin';
import {getListByPage} from '@/api/claim/factory/PartAndFault';
import config from '@/assets/js/config';
export default {
  props: ['type', 'rowData'],
  mixins: [dictionary],
  components: {
    SelectWeiXiuGongDan,
    Selectzhusunjian,
    Selectguzhangxianxiang,
    Selectguzhangyuanyin,
    Selectzifeigongdan,
    Weixiuxiangmulist,
    Peijianhuanshangjianlist,
    Peijianhuanxiajianlist,
    fujiaxiangmulist,
    yushouquan,
    jiuyuandanhao,
    SupplierList,
    SelectReportNo,
    BatchActivities,
    PeiJianSelect,
    addDialog,
    videos,
    PartSelect,
    uploadFile
  },
  data() {
    return {
      uploadPrefix: config.uploadUrl,// 附件上传前缀
      dataVin:'',
      uploadDate: {},
      upVisible: false,
      form: {
        fileList: []
      },
      src: null,
      list: [],
      isvideo: false,
      syncList: [],
      columnsFile: this.createdTable(),
      actions: { type: 'add', title: '', visible: false, data: null },
      formData: {},
      helpVin: null,
      loading: false,
      addFlag: false,
      fileList: [],
      dataList: [],
      dataList1: [],
      selects: [],
      huanxiajiandataList: [],
      fujiaxiangmudataList: [],
      visible: false,
      visibleDrawer: false,
      peijianhuanxiajianlistaddflag: false,
      fujiaxiangmuCloselistaddflag: false,
      weixiuxiangmulistaddflag: false,
      peijianhuanshangjianlistaddflag: false,
      Peijianhuanxiajianlistaddflag: false,
      fujiaxiangmulistaddflag: false,
      peijianhuanxiajianlistchangeflag: false,
      collapse: true,
      outformList: this.outformListFn(),
      outAmountformList: this.outAmountformListFn(),
      zifeigongdan: false,
      weixiugongdan: false,
      guzhangyuanyin: false,
      zhusunjian: false,
      guzhangxianxiangdaima: false,
      infoId: null,
      // topFilterInit: this.topFilterInitFun(),
      flterValue: {}, //参数
      columns: this.creatHeader(),
      columns1: this.creatHeader1(),
      columnshuanxiajian: this.columnshuanxiajianFn(),
      columnsfujiaxiangmu: this.columnsfujiaxiangmuFn(),
      // fetchApi: getUser,
      fetchParams: {}, //ipa 接口
      selectedRows: [], //选中经销商
      formList: this.createFormList(),
      formList1: this.formList1Fn(),
      feiyongformList: this.feiyongformListFn(),
      saveData3: null,
      saveData1: null,
      saveData4: null,
      saveData: {}, //保存对象
      activeName: '审核记录',
      yushouquan: false,
      jiuyuandanhao: false,
      sumAmountsum: 0,
      sumfujiafeiyong: 0,
      sumfujiafeiyongz: 0,
      sumweixiufeiyongz: 0,
      partAmountsumz: 0,
      sumLabourSum: 0,
      partAmountsum: 0,
      sumPeiJianFeiYong: 0,
      // sumAmountsum: 0,
      saveFlag: 0,
      id: '',
      suppliers: false,
      reportFlag: false,
      rowDate: {},
      batchActivities: false,
      finalLabourList: [],
      finalPartRList: [],
      flag: false,
      paraCode: null,
      appId: null,
      ysy:null,
      menus: [
        {
          title: '审核记录',
          path: 'claimDemage/BasicData/ClaimApplication/jiluandlishi/shenhejilu',
          params: {
            type: 1,
            claimId: this.rowData.claimId
          }
        },
        {
          title: '维修历史',
          path: 'claimDemage/BasicData/ClaimApplication/jiluandlishi/weixiulishi',
          // disabled: true,
          params: {
            type: 2,
            vin: ''
          }
        },
        {
          title: '索赔历史',
          path: 'claimDemage/BasicData/ClaimApplication/jiluandlishi/suopeilishi',
          // disabled: true,
          params: {
            type: 3,
            roNo: ''
          }
        },
        // {
        //   title: '变更记录',
        //   path: 'claimDemage/BasicData/ClaimApplication/jiluandlishi/biangengjilu',
        //   // disabled: true,
        //   params: {
        //     tgetRoByIdype: 4,
        //     claimId: this.rowData.claimId
        //   }
        // }
      ]
    };
  },
  async created() {
    this.loading = true;
    if(getAppId()=='arcfox'){
        this.formList1.find(x => x.fieldName == 'sysCode1').disabled = true
        this.formList1.find(x => x.fieldName == 'sysName1').disabled = true
        this.formList1.find(x => x.fieldName == 'sysCode2').disabled = true
        this.formList1.find(x => x.fieldName == 'sysName2').disabled = true
        this.formList1.find(x => x.fieldName == 'sysCode3').disabled = true
        this.formList1.find(x => x.fieldName == 'sysName3').disabled = true
        this.formList1.find(x => x.fieldName == 'sysCode4').disabled = true
        this.formList1.find(x => x.fieldName == 'sysName4').disabled = true
        this.formList1.find(x => x.fieldName == 'faultName').disabled = true
        this.formList1.find(x => x.fieldName == 'ifTrailer').hidden = true
        this.columnshuanxiajian.find(x => x.dataIndex == 'partCodeBefore').hidden = true
        this.columnshuanxiajian.find(x => x.dataIndex == 'partNameBefore').hidden = true
      }
    this.appId = await getAppId();
    await this.chuqi();
    await this.getAuthListByauthNo(this.rowData.claimId);
    if (this.rowData.roNo) {
      this.loading = true;
      await this.getListByPageWork(this.rowData.roNo);
      this.loading = false;
    }
    console.log(this.rowData,"dasazi")
    this.dataVin = this.rowData.vin;
    console.log('ddddddd',this.dataVin)
    this.loading = false;
  },
  async mounted() {
    // this.loading = true;
    // // await this.chuqi();
    // if(this.rowData.roNo){
    //   await this.getListByPageWork(this.rowData.roNo);
    // }
    // this.loading = false;
  },
  methods: {
    dealercloseHandler() {
      this.isvideo = false;
    },
    // 上传成功回调
    successHandler(val) {
      if (val == 1) {
        this.loading = true;
      } else {
        this.loading = false;
        if (val && val.length > 0) {
          if (val[0].url.errorList && val[0].url.errorList.length > 0) {
            this.errorList = val[0].url.errorList;
          } else {
            let json = JSON.parse(JSON.stringify(val));
            let data = {};
            data.createdAt = moment().format('YYYY-MM-DD HH:mm:ss');
            data.title = json[json.length - 1].name;
            data.fileUrl = json[json.length - 1].url;
            this.$refs.fileTable.$refs.pageTable.EXECUTE_INSERT(data);
          }
        } else {
          this.errorList = [];
        }
      }
    },
    video(val) {
      this.isvideo = true;
      this.src = val.fileUrl;
    },
    delVideo(val) {
      console.log('#@!#!', val);
      this.$refs.fileTable.$refs.pageTable.EXECUTE_DELETE([val]);
    },
    getFileType(fileName) {
      let fileType = fileName.substring(fileName.lastIndexOf('.') + 1, fileName.length);
      return fileType;
    },
    async getListByPageWork(roNo) {
      var  typeClaim = this.formList1.find(x => x.fieldName == 'cmsClaimType').initialValue
      // if( this.formList1.find(x => x.fieldName == 'ifComm').initialValue){
      //   if( this.formList1.find(x => x.fieldName == 'ifComm').initialValue  == 55431002){
      //     typeClaim = null;
      //   }
      // }
      let res = await queryRepairDetail({ roNo: roNo, paraCode: this.paraCode,cmsClaimType:typeClaim }); // 工单接口
      this.paraCode = null;
      let data = { ...res.data };
      this.acData = res.data;
      let res1 = await queryPreClaimLog({ roNo: roNo, id: this.rowData.claimId }); // 根据vin查询车辆备件
      this.xcData = res1.data;
      // let data1 = res1.data;
      // this.formList.find(x => x.fieldName == 'applyName').initialValue = res.data.applyName;
      // this.formList.find(x => x.fieldName == 'applyPhone').initialValue = res.data.applyPhone;
      if (this.cmsClaimType == 55011011) {
        this.typeForAC();
        // if(this.formList1.find(x => x.fieldName == 'ifComm').initialValue == 55431001) {
        //   this.flag = false;
        // }else{
        //   this.flag = true;
        // }
        this.columnshuanxiajian.find(x => x.dataIndex == 'partCount').editable = false;
        this.columns1.find(x => x.dataIndex == 'partCount').editable = false;
      } else {
        if (this.cmsClaimType != 55011009) {
          this.columnshuanxiajian.find(x => x.dataIndex == 'partCount').editable = false;
          // this.columns1.find(x=>x.dataIndex=='partCount').editable=true;
          this.flag = false;
        }

        let arr = [];
        if (res.data && res1.data) {
          arr = [...(res1.data.labourList || [])];
        }
        let gdList = data.labourList || [];
        let dataList = [];

        // 遍历两个数组，并判断数值是否相等，如果相等，就将空字符串赋值给该数值
        for (var i = 0; i < gdList.length; i++) {
          for (var j = 0; j < arr.length; j++) {
            if (gdList[i].labourCode == arr[j].labourCode) {
              gdList[i] = '';
              arr[j] = '';
              break; //如果存在arr01[i]=arr02[j]，就跳出这个for循环
            }
          }
        }

        //然后将数组中的非空元素添加到newArr
        for (var i = 0; i < gdList.length; i++) {
          if (gdList[i] != '') {
            dataList.push(gdList[i]);
          }
        }
        console.log('111', dataList); //[1]
        for (var j = 0; j < arr.length; j++) {
          if (arr[j] != '') {
            dataList.push(arr[j]);
          }
        }
        console.log('222', dataList); //[1,4]

        // for (let i = 0; i < gdList.length; i++) {
        //   if (arr.find(x => x.labourCode != gdList[i].labourCode)) {
        //
        //   }else{
        //     dataList.push(gdList[i]);
        //   }
        // }

        let arr1 = [];
        if (res.data && res1.data) {
          arr1 = [...(res1.data.partRList || [])];
        }
        let sjList = data.partRList || [];
        let dataList1 = [];
        console.log(sjList);
        for (let i = 0; i < sjList.length; i++) {
          if (arr1.find(x => x.partCode == sjList[i].partCode)) {
            dataList1.push(sjList[i]);
          }
        }
        // //下件
        // let newList = []; // 可用备件数量
        // if(res1.data.partList.length>0){
        //   let arr1 = [];
        //   if(res1.data ){
        //     arr1 = [...res1.data.partList || []];
        //   }
        //   let xjList = [...data.partList] || [];
        //   for (let i = 0 ; i < xjList.length ;i++) {
        //     if(arr1.find(x => x.partCode == xjList[i].partCode)) {
        //       xjList[i].lessCount = xjList[i].partCount -  arr1.find(x => x.partCode == xjList[i].partCode).partCount ;
        //      if(xjList[i].isUseSetMealPackage!='10041001'){
        //        newList.push({...xjList[i]});
        //      }
        //     }
        //   }
        // }else{
        //   let xjList = [...data.partList] || [];
        //   for (let i = 0 ; i < xjList.length ;i++) {
        //     xjList[i].lessCount = xjList[i].partCount;
        //     if(xjList[i].isUseSetMealPackage!='10041001'){
        //       newList.push({...xjList[i]});
        //     }
        //   }
        // }
        // if(this.newVar.partList.length>0 && this.newVar.roNo ==roNo){
        //   this.newVar.partList.map(x => {
        //     if(newList.find(n => n.partCode == x.partCode)) {
        //       newList.find(n => n.partCode == x.partCode).partCount = x.partCount;
        //     }
        //   })
        // }else{
        //   newList.map(x => {
        //     x.partCount = x.lessCount;
        //   })
        // }
        // //编辑时数量为0的件查不出来 需要把剩余数量为0的件数量改为0
        // newList.map(x => {
        //   if(x.lessCount==0){
        //     x.partCount = x.lessCount;
        //   }
        // })
        //
        // this.$refs.table2.$refs.pageTable.EXECUTE_INSERT(newList);

        // //上件
        let newList1 = []; // 可用备件数量
        if (res1.data.partRList.length > 0) {
          let arr2 = [];
          if (res1.data) {
            arr2 = [...(res1.data.partRList || [])];
          }
          let sjList = [...data.partList] || [];
          for (let i = 0; i < sjList.length; i++) {
            if (arr2.find(x => x.partCode == sjList[i].partCode)) {
              sjList[i].lessCount = sjList[i].partCount - arr2.find(x => x.partCode == sjList[i].partCode).partCount;
              sjList[i].cmsClaimAmount = parseFloat(sjList[i].cmsClaimPrice * arr2.find(x => x.partCode == sjList[i].partCode).partCount).toFixed(2);
              if (sjList[i].isUseSetMealPackage != '10041001') {
                newList1.push({ ...sjList[i] });
              }
            } else {
              if (sjList[i].isUseSetMealPackage != '10041001') {
                newList1.push({ ...sjList[i] });
              }
            }
          }
        } else {
          let sjList = [...data.partList] || [];
          for (let i = 0; i < sjList.length; i++) {
            sjList[i].lessCount = sjList[i].partCount;
            if (sjList[i].isUseSetMealPackage != '10041001') {
              newList1.push({ ...sjList[i] });
            }
          }
        }
        dataList1 = [...newList1];
        console.log('***', dataList1);
        this.finalPartRList = dataList1;
        if (this.newVar.partRList.length > 0 && this.newVar.roNo == roNo) {
          this.newVar.partRList.map(x => {
            if (newList1.find(n => n.partCode == x.partCode)) {
              newList1.find(n => n.partCode == x.partCode).partCount = x.partCount;
              // newList1.find(n => n.partCode == x.partCode).cmsClaimAmount = parseFloat(x.cmsClaimPrice * x.partCount).toFixed(2);
            }
          });
        } else {
          newList1 = [];
          // newList1.map(x => {
          //   x.partCount = x.lessCount;
          //   x.cmsClaimAmount = parseFloat(x.cmsClaimPrice * x.partCount).toFixed(2);
          // });
        }

        newList1.map(x => {
          if (x.lessCount == 0) {
            x.partCount = x.lessCount;
            x.cmsClaimAmount = 0;
          }
        });

        let samearr = [];
        for (let i = 0; i < this.newVar.partRList.length; i++) {
          let temp = this.newVar.partRList[i];
          for (let j = 0; j < newList1.length; j++) {
            if (newList1[j].partCode === temp.partCode) {
              samearr.push(newList1[j]);
            }
          }
        }
        console.log('13333', this.newVar.partRList);
        console.log('#######1', newList1);
        console.log('#######!', samearr);
        if (this.rowData.cmsClaimType != 55011009) {
          this.$refs.table1.$refs.pageTable.EXECUTE_INSERT(samearr);
        }
        if(this.cmsClaimType == 55011006 ||this.cmsClaimType == 55011007){

        }else{
          this.changeCells();
        }


        // for (let i in data.labourList) {
        //   if(data1.labourList.length>0){
        //     for (let j in data1.labourList) {
        //       if(data.labourList[i]){
        //         if (data.labourList[i].labourCode == data1.labourList[j].labourCode) {
        //         }else{
        //           arr.push(data.labourList[i])
        //           console.log("^^^^^^^^^^^^^^^"+i,arr)
        //         }
        //       }
        //       }
        //   }else{
        //     arr.push(data.labourList[i])
        //     console.log("$$$$$$$$$$$"+i,arr)
        //   }
        //
        // }
        // this.$refs.table.$refs.pageTable.list.map(x => {
        //   dataList.push(x);
        // });
        this.finalLabourList = dataList;
      }

      for (let i in data) {
        this.formList.map(y => {
          if ('customerPhone' == y.fieldName) {
            y.initialValue = data.customerPhone;
          }
          if ('serviceName' == y.fieldName) {
            y.initialValue = data.serviceName;
          }
          if ('servicePhone' == y.fieldName) {
            y.initialValue = data.servicePhone;
          }
          if ('applyName' == y.fieldName) {
            y.initialValue = data.applyName;
          }
          if ('useType' == y.fieldName) {
            y.initialValue = data.useType == null ? null : Number(data.useType);
          }
        });
      }
      // if(data.repairTypeName == "首保" ){
      //   this.formList1.find(x => x.fieldName == 'cmsClaimType').initialValue = 55011006;
      //   this.formList1.find(x => x.fieldName == 'cmsClaimType').disabled = true;
      // }else if(data.repairTypeName == "PDI"){
      //   this.formList1.find(x => x.fieldName == 'cmsClaimType').initialValue = 55011007;
      //   this.formList1.find(x => x.fieldName == 'cmsClaimType').disabled = true;
      // }
    },
    async getAuthListByauthNo(id) {
      let res = await quySP({ id: id });
      let data = res.data;
      console.log(data,"xixixiix")
      //临时属性
      this.partId = data.partId; //主损件id
      this.supId = data.supId; //供应商ID
      this.supCode = data.supCode; //供应商Code
      this.faultAppear = data.faultAppear; //故障现象
      this.modelId = data.modelId; //车型id
      this.modelCode = data.modelCode; //车型Code
      this.faId = data.faId; //故障现象主键
      this.isDeleted = data.isDeleted;
      this.addAmount = data.addAmount;
      this.sumfujiafeiyongz = data.addAmount;
      this.sumweixiufeiyongz = data.labourAmount;
      this.partAmountsumz = data.partAmount;
      this.applyAt = data.applyAt;
      this.applyBy = data.applyBy;
      this.claimNo = data.claimNo;
      this.claimStatus = data.claimStatus;
      this.cmsClaimType = data.cmsClaimType;
      if(this.cmsClaimType){
        if ( this.cmsClaimType == 55011010) {
          this.addFlag =true;
        }else{
          this.addFlag =false;
        }
      }

      this.rescueNo = data.outNo;
      // this.authNo = data.authNo;
      console.log(777777777);
      console.log(data.outId);
      this.outId = data.outId;
      this.outCode = data.outCode;
      this.menus[2].params.roNo = data.vin;
      this.menus[1].params.vin = data.vin;
      this.rowDate.roNo = data.roNo;
      this.rowDate.vin = data.vin;
      this.rowDate.MODEL_CODE = data.modelCode;
      this.rowDate.partCode = '';
      if (data.supName) {
        this.rowDate.partCode = data.partCode;
      }
      this.rowDate.driveMile = data.driveMile;
      this.rowDate.serviceBeginDate = data.serviceBeginDate;
      this.frId = data.frId; //故障原因主键
      // this.prodDate = data.prodDate;
      // if (data.batchCode) {
      //   if(this.formList1.find(x => x.fieldName == 'ifComm').initialValue == 55431001) {
      //     this.flag = false;
      //   }else{
      //     this.flag = true;
      //   }
      // }
      if (data.saleDate) {
        data.saleDate = moment(data.saleDate).format('YYYY-MM-DD');
      }
      if (data.prodDate) {
        data.prodDate = moment(data.prodDate).format('YYYY-MM-DD');
      }
      if (data.repairBeginDate) {
        data.repairBeginDate = moment(data.repairBeginDate).format('YYYY-MM-DD');
      }
      //为2个form赋值
      for (let i in data) {
        this.formList.map(y => {
          if (i == y.fieldName) {
            y.initialValue = data[i];
          }
        });
        this.formList1.map(y => {
          if (i == y.fieldName) {
            y.initialValue = data[i];
//             console.log(data.ifTrailer,"aaaaaaaaaa");
//            if(data.ifTrailer!==1||data.ifTrailer==null){
//          this.formList1.find(x => x.fieldName == 'ifTrailer').initialValue =0;
//        }else{
//         this.ifTrailer= data.ifTrailer;
//        }
          }
      // if(data.ifTrailer!==1||data.ifTrailer==null){
      //   this.ifTrailer== 0;
      // }else{
      //  this.ifTrailer= data.ifTrailer;
      // }
          if ('cmsClaimType' == y.fieldName) {
            y.initialValue = data.cmsClaimType;
            if (y.initialValue == 55011004) {
              this.formList1.map(y => {
                if (y.fieldName == 'selfNo') {
                  y.hidden = false;
                  y.initialValue = data.selfNo;
                }
                if (y.fieldName == 'selfSdate') {
                  y.hidden = false;
                  y.initialValue = data.selfSdate;
                }
                if (y.fieldName == 'selfUseMile') {
                  y.hidden = false;
                  y.initialValue = data.selfUseMile;
                }
                if (y.fieldName == 'selfUseHours') {
                  y.hidden = false;
                  y.initialValue = data.selfUseHours;
                }
                if (y.fieldName == 'selfMile') {
                  y.hidden = false;
                  y.initialValue = data.selfMile;
                }
              });
            } else if (y.initialValue == 55011009) {
              this.formList1.map(y => {
                if (y.fieldName == 'batchCode') {
                  y.disabled = false;
                  y.initialValue = data.batchCode;
                  y.rules[0].required = true;
                }
              });
              this.columnshuanxiajian.find(x => x.dataIndex == 'partCount').editable = false;
              this.columns1.find(x => x.dataIndex == 'partCount').editable = false;
              // if(this.formList1.find(x => x.fieldName == 'ifComm').initialValue == 55431001) {
              //   this.flag = false;
              // }else{
              //   this.flag = true;
              // }
            } else if (y.initialValue == 55011003 || y.initialValue == 55011010 || y.initialValue == 55011005) {
              this.formList1.map(y => {
                if (y.fieldName == 'authNo') {
                  y.rules[0].required = true;
                  y.initialValue = data.authNo;
                }
              });
            }
          }
          if (y.fieldName == 'faultCode' || y.fieldName == 'faultName') {
            if (data['faultCode']) {
              y.readonly = true;
            }
          }
          if (y.fieldName == 'frName' || y.fieldName == 'frCode') {
            if (data['faultCode']) {
              y.readonly = true;
            }
          }
        });
        this.feiyongformList.map(y => {
          if (i == y.fieldName) {
            y.initialValue = data[i];
          }
        });
      }
      for (let i in data.fileList) {
        if (data.fileList[i].type == 55141001) {
          if (data.fileList[i].fileUrl) {
            this.formList1.find(x => x.fieldName == 'wayPicture').initialValue = [data.fileList[i].fileUrl];
          }
        } else if (data.fileList[i].type == 55141002) {
          if (data.fileList[i].fileUrl) {
            this.formList1.find(x => x.fieldName == 'wayPicture1').initialValue = [data.fileList[i].fileUrl];
          }
        } else if (data.fileList[i].type == 55141003) {
          if (data.fileList[i].fileUrl) {
            this.formList1.find(x => x.fieldName == 'wayPicture2').initialValue = [data.fileList[i].fileUrl];
          }
        } else if (data.fileList[i].type == 55141004) {
          if (data.fileList[i].fileUrl) {
            this.formList1.find(x => x.fieldName == 'wayPicture3').initialValue = [data.fileList[i].fileUrl];
          }
        } else if (data.fileList[i].type == 55141005) {
          if (data.fileList[i].fileUrl) {
            this.formList1.find(x => x.fieldName == 'wayPicture4').initialValue = [data.fileList[i].fileUrl];
          }
        } else if (data.fileList[i].type == 55141006) {
          if (data.fileList[i].fileUrl) {
            this.formList1.find(x => x.fieldName == 'wayPicture5').initialValue = [data.fileList[i].fileUrl];
          }
        }
      }
      //为table赋值
      let newFile = [];
      for (let i in data.fileList) {
        if (data.fileList[i].type == null) {
          newFile.push(res.data.fileList[i]);
        }
      }
      this.$refs.fileTable.$refs.pageTable.EXECUTE_INSERT(newFile);
      if (200 == res.resultCode) {
        let data = res.data;
        if (isFormEmpty(data)) {
          data = {};
        }
        let records = data.labourList;
        if (isFormEmpty(records)) {
          records = [];
        }
        this.$refs.table.$refs.pageTable.EXECUTE_INSERT(records);
        let records1 = data.addList;
        if (isFormEmpty(records1)) {
          records1 = [];
        }
        this.$refs.table3.$refs.pageTable.EXECUTE_INSERT(records1);
      }
      let records2 = data.partList;
      if (isFormEmpty(records2)) {
        records2 = [];
      }
      this.$refs.table2.$refs.pageTable.EXECUTE_INSERT(records2);
      if (res.data.cmsClaimType == 55011009) {
        let records3 = data.partRList;
        if (isFormEmpty(records3)) {
          records3 = [];
        }
        this.$refs.table1.$refs.pageTable.EXECUTE_INSERT(records3);
      }

      if (res.data.cmsClaimType == 55011006) {
        await this.typeForSB();
      } else if (res.data.cmsClaimType == 55011007) {
        await this.typeForPDI();
      }

      console.info(res);
      this.newVar = data;
    },

    // async selectRowById(val) {
    //   //掉外部接口 工单号 取得工单信息
    //   let res = await quyRomessage({ roNo: val });
    //   let data = res.data;
    //   for (let i in data) {
    //     this.formList.map(y => {
    //       if (i == y.fieldName) {
    //         y.initialValue = data[i];
    //       }
    //     });
    //   }
    // },
    changeCells() {
      let sumsjfeiyong = 0;
      this.$refs.table1.$refs.pageTable.list.map(x => {
        sumsjfeiyong += Number(x.cmsClaimAmount);
      });
      let realVal = parseFloat(sumsjfeiyong).toFixed(2);
      this.feiyongformList.map(x => {
        if ('partAmount' == x.fieldName) {
          x.initialValue = realVal;
        }
      });
      this.sumAmount();
    },
    changeCells1() {
      let sumsjfeiyong = 0;
      this.$refs.table3.$refs.pageTable.list.map(x => {
        sumsjfeiyong += Number(x.addAmount);
      });
      let realVal = parseFloat(sumsjfeiyong).toFixed(2);
      this.feiyongformList.map(x => {
        if ('addAmount' == x.fieldName) {
          x.initialValue = realVal;
        }
      });
      this.sumAmount();
    },
    async typeForSB() {
      this.loading = true;
      if( this.formList1.find(x => x.fieldName == 'ifComm').initialValue){
        if( this.formList1.find(x => x.fieldName == 'ifComm').initialValue  == 55431002){
          const res = await selectByParaCode({ paraCode: 'XTCS00018' });
          if (res.resultCode == 200) {
            if (res.data.para1 == '是') {
              this.paraCode = null;
              this.feiyongformList.find(x => x.fieldName == 'priceAmount').initialValue = res.data.para2;
            } else {
              this.paraCode = 'XTCS00027';
              this.feiyongformList.find(x => x.fieldName == 'priceAmount').initialValue = null;
            }
          }
        }else{
          //油车 code
          const res = await selectByParaCode({ paraCode: 'XTCS00037' });
          if (res.resultCode == 200) {
            if (res.data.para1 == '是') {
              this.paraCode = null;
              this.feiyongformList.find(x => x.fieldName == 'priceAmount').initialValue = res.data.para2;
            } else {
              this.paraCode = 'XTCS00039';
              this.feiyongformList.find(x => x.fieldName == 'priceAmount').initialValue = null;
            }
          }
        }
      }

      this.loading = false;
    },
    async typeForPDI() {
      this.loading = true;
      if( this.formList1.find(x => x.fieldName == 'ifComm').initialValue){
        if( this.formList1.find(x => x.fieldName == 'ifComm').initialValue  == 55431002){
          const res = await selectByParaCode({ paraCode: 'XTCS00017' });
          if (res.resultCode == 200) {
            if (res.data.para1 == '是') {
              this.paraCode = null;
              this.feiyongformList.find(x => x.fieldName == 'priceAmount').initialValue = res.data.para2;
            } else {
              this.paraCode = 'XTCS00026';
              this.feiyongformList.find(x => x.fieldName == 'priceAmount').initialValue = null;
            }
          }
        }else{
          //油车 code
          const res = await selectByParaCode({ paraCode: 'XTCS00036' });
          if (res.resultCode == 200) {
            if (res.data.para1 == '是') {
              this.paraCode = null;
              this.feiyongformList.find(x => x.fieldName == 'priceAmount').initialValue = res.data.para2;
            } else {
              this.paraCode = 'XTCS00038';
              this.feiyongformList.find(x => x.fieldName == 'priceAmount').initialValue = null;
            }
          }
        }
      }
      this.loading = false;
    },
    async typeForBJ() {
      this.$refs.table.$refs.pageTable.EXECUTE_DELETE(this.$refs.table.$refs.pageTable.list);
      this.$refs.table1.$refs.pageTable.EXECUTE_DELETE(this.$refs.table1.$refs.pageTable.list);
      this.$refs.table2.$refs.pageTable.EXECUTE_DELETE(this.$refs.table2.$refs.pageTable.list);
      this.$refs.table3.$refs.pageTable.EXECUTE_DELETE(this.$refs.table3.$refs.pageTable.list);
      this.feiyongformList.find(x => 'sumAmount' == x.fieldName).initialValue = 0;
      this.feiyongformList.find(x => 'labourAmount' == x.fieldName).initialValue = 0;
      this.feiyongformList.find(x => 'partAmount' == x.fieldName).initialValue = 0;
      this.feiyongformList.find(x => 'addAmount' == x.fieldName).initialValue = 0;
      await this.getListByPageWork(this.rowDate.roNo);
      this.acData.partList.map(x => {
        x.lessCount = x.partCount;
      });
      if (isFormEmpty(this.acData)) {
        this.acData = {};
      }
      let records = this.acData.labourList;
      if (isFormEmpty(records)) {
        records = [];
      }
      this.$refs.table.$refs.pageTable.list.map(x => {
        this.delsFun(x);
      });
      this.$refs.table.$refs.pageTable.EXECUTE_DELETE(this.$refs.table.$refs.pageTable.list);
      for (let i in records) {
        if (records[i].isUseSetMealPackage != '10041001') {
          this.weixiuxiangmulistSave(records[i]);
        }
      }
      for (let i in this.xcData.labourList) {
        this.$refs.table.$refs.pageTable.list.map(x => {
          if (x.labourCode == this.xcData.labourList[i].labourCode) {
            this.delsFun(x);
          }
        });
      }
      let arr = [];
      this.$refs.table.$refs.pageTable.list.map(x => {
        arr.push(x);
      });
      this.finalLabourList = arr;
      let records1 = this.acData.addList;
      if (isFormEmpty(records1)) {
        records1 = [];
      }
      this.$refs.table3.$refs.pageTable.EXECUTE_DELETE(this.$refs.table3.$refs.pageTable.list);
      this.feiyongformList.map(x => {
        if ('addAmount' == x.fieldName) {
          x.initialValue = 0;
          this.sumAmount();
        }
      });

      for (let i in records1) {
        if (records1[i].isUseSetMealPackage != '10041001') {
          this.fujiaxiangmuSave(records1[i]);
        }
      }
      for (let i in this.xcData.addList) {
        this.$refs.table3.$refs.pageTable.list.map(x => {
          if (x.addCode == this.xcData.addList[i].addCode) {
            this.delsFunFj(x);
          }
        });
      }
      let records2 = this.acData.partList;
      if (isFormEmpty(records2)) {
        records2 = [];
      }
      this.$refs.table2.$refs.pageTable.EXECUTE_DELETE(this.$refs.table2.$refs.pageTable.list);

      for(let i in records2){
        //   if(records2[i].isUseSetMealPackage != "10041001") {
        //     this.peijianhuanxiajianSave({...records2[i]})
        //   }
        // }
        // for (let i in this.xcData.partList) {
        //   this.$refs.table2.$refs.pageTable.list.map(x => {
        //     // x.lessCount = x.partCount;
        //     if(x.partCode==this.xcData.partList[i].partCode){
        //       x.lessCount = Number(x.partCount)-Number(this.xcData.partList[i].partCount==null?0:this.xcData.partList[i].partCount);
        //       x.partCount = 0
        this.$refs.table2.$refs.pageTable.EXECUTE_INSERT(records2[i]);
        //     }
        //   })
      }
      this.changeCells();
    },
    //针对ARCFOX新需求开放的备件接口
    typeForAC() {
      //删除所有现有备件 以及清楚列表的钱数
      this.$refs.table.$refs.pageTable.EXECUTE_DELETE(this.$refs.table.$refs.pageTable.list);
      this.$refs.table1.$refs.pageTable.EXECUTE_DELETE(this.$refs.table1.$refs.pageTable.list);
      this.$refs.table2.$refs.pageTable.EXECUTE_DELETE(this.$refs.table2.$refs.pageTable.list);
      this.$refs.table3.$refs.pageTable.EXECUTE_DELETE(this.$refs.table3.$refs.pageTable.list);
      this.feiyongformList.find(x => 'sumAmount' == x.fieldName).initialValue = 0;
      this.feiyongformList.find(x => 'labourAmount' == x.fieldName).initialValue = 0;
      this.feiyongformList.find(x => 'partAmount' == x.fieldName).initialValue = 0;
      this.feiyongformList.find(x => 'addAmount' == x.fieldName).initialValue = 0;
      let records = this.acData.labourList;
      if (this.xcData.isPackageFlag == '0') {
        let records = this.acData.labourList;
        //分出是套餐包的件
        if (isFormEmpty(records)) {
          records = [];
        }
        for (let i in records) {
          if (records[i].isUseSetMealPackage == '10041001') {
            this.weixiuxiangmulistSave(records[i]);
          }
        }
        let records1 = this.acData.addList;
        if (isFormEmpty(records1)) {
          records1 = [];
        }
        for (let i in records1) {
          if (records1[i].isUseSetMealPackage == '10041001') {
            this.fujiaxiangmuSave(records1[i]);
          }
        }
        let records2 = this.acData.partList;
        if (isFormEmpty(records2)) {
          records2 = [];
        }
        for (let i in records2) {
          if (records2[i].isUseSetMealPackage == '10041001') {
            this.peijianhuanshangjianSave(records2[i]);
          }
        }
        for (let i in records2) {
          if (records2[i].isUseSetMealPackage == '10041001') {
            this.peijianhuanxiajianSave(records2[i]);
          }
        }
      }
    },
    batchActivitiesClose() {
      this.batchActivities = false;
    },
    batchActivitiesShow() {
      if (this.rowDate.vin && this.rowDate.roNo) {
        this.batchActivities = true;
      } else {
        this.$notify.error({ title: '提示信息', message: '请选择维修工单' });
      }
    },
    async batchActivitiesSave(val) {
      if (val[0].isOne == 10041001) {
        this.feiyongformList.find(x => x.fieldName == 'priceAmount').initialValue = val[0].oneAmount;
      } else {
        this.feiyongformList.find(x => x.fieldName == 'priceAmount').initialValue = null;
      }
      await this.zhusunjianSave(val);
      this.feiyongformList.find(x => 'sumAmount' == x.fieldName).initialValue = 0;
      this.feiyongformList.find(x => 'labourAmount' == x.fieldName).initialValue = 0;
      this.feiyongformList.find(x => 'partAmount' == x.fieldName).initialValue = 0;
      this.feiyongformList.find(x => 'addAmount' == x.fieldName).initialValue = 0;
      this.formList1.find(x => x.fieldName == 'batchCode').initialValue = val[0].batchCode;
      this.formList1.find(x => x.fieldName == 'batchName').initialValue = val[0].batchName;
      this.formList1.find(x => x.fieldName == 'sysCode1').initialValue = val[0].sysCode1;
      this.formList1.find(x => x.fieldName == 'sysName1').initialValue = val[0].sysName1;
      this.formList1.find(x => x.fieldName == 'sysCode2').initialValue = val[0].sysCode2;
      this.formList1.find(x => x.fieldName == 'sysName2').initialValue = val[0].sysName2;
      this.formList1.find(x => x.fieldName == 'sysCode3').initialValue = val[0].sysCode3;
      this.formList1.find(x => x.fieldName == 'sysName3').initialValue = val[0].sysName3;
      this.formList1.find(x => x.fieldName == 'sysCode4').initialValue = val[0].sysCode4;
      this.formList1.find(x => x.fieldName == 'sysName4').initialValue = val[0].sysName4;
      this.formList1.find(x => x.fieldName == 'faultCode').initialValue = val[0].faultCode;
      this.formList1.find(x => x.fieldName == 'faultName').initialValue = val[0].faultName;
      this.faultId = val[0].faultId;
      this.formList1.find(x => x.fieldName == 'frCode').initialValue = val[0].frCode;
      this.formList1.find(x => x.fieldName == 'frName').initialValue = val[0].frName;
      this.frId = val[0].frId;
      this.supCode = val[0].supCode;
      this.planAmount = val[0].planAmount;
      this.formList1.find(x => x.fieldName == 'supName').initialValue = val[0].supName;
      // let res = await getTtRpMaList({vin:this.rowDate.vin,roNo:this.rowDate.roNo,modelCode:this.rowDate.modelCode,currentPage:1,pageSize:999});
      let res1 = await queryPreClaimLog({ roNo: this.rowDate.roNo, id: this.rowData.claimId });
      let data = val[0];
      let data1 = res1.data;
      if (isFormEmpty(data)) {
        data = {};
      }
      if (isFormEmpty(data1)) {
        data1 = {};
      }
      let records = data.ttRpMaLabours;
      if (isFormEmpty(records)) {
        records = [];
      }
      this.$refs.table.$refs.pageTable.EXECUTE_DELETE(this.$refs.table.$refs.pageTable.list);
      for (let i in records) {
        records[i].cmsClaimPrice = records[i].labourPrice;
        records[i].cmsClaimAmount = records[i].labourSumPrice;
        records[i].labourHours = records[i].stdLabourHour;
        records[i].cmsClaimType = records[i].labourType;
        records[i].isDeleted = 0;
        this.weixiuxiangmulistSave(records[i]);
      }
      // for (let i in data1.labourList) {
      //   this.$refs.table.$refs.pageTable.list.map(x => {
      //     if (x.labourCode == data1.labourList[i].labourCode) {
      //       this.delsFun(x);
      //     }
      //   });
      // }
      let arr = [];
      this.$refs.table.$refs.pageTable.list.map(x => {
        arr.push(x);
      });
      this.finalLabourList = arr;
      // let records1 = data.addList;
      // if (isFormEmpty(records1)) {
      //   records1 = [];
      // }
      // this.$refs.table3.$refs.pageTable.EXECUTE_DELETE(this.$refs.table3.$refs.pageTable.list);
      // this.fujiaxiangmuSave(records1)
      // for (let i in data1.addList) {
      //   this.$refs.table3.$refs.pageTable.list.map(x => {
      //     if(x.addCode==data1.addList[i].addCode){
      //       this.delsFunFj(x)
      //     }
      //   })
      // }
      let records2 = data.ttRpMaParts;
      if (isFormEmpty(records2)) {
        records2 = [];
      }
      this.$refs.table2.$refs.pageTable.EXECUTE_DELETE(this.$refs.table2.$refs.pageTable.list);
      for (let i in records2) {
        records2[i].partUnit = records2[i].unit;
        records2[i].cmsClaimPrice = records2[i].price;
        records2[i].cmsClaimAmount = records2[i].amount;
        records2[i].partCount = records2[i].counts;
        records2[i].lessCount = records2[i].partCount;
        this.peijianhuanxiajianSave2(records2[i]);
      }
      // for (let i in data1.partList) {
      //   this.$refs.table2.$refs.pageTable.list.map(x => {
      //     if (x.partCode == data1.partList[i].partCode) {
      //       this.$refs.table2.$refs.pageTable.EXECUTE_DELETE([x]);
      //     }
      //   });
      // }
      let records3 = data.ttRpMaParts;
      if (isFormEmpty(records3)) {
        records3 = [];
      }
      this.$refs.table1.$refs.pageTable.EXECUTE_DELETE(this.$refs.table1.$refs.pageTable.list);
      for (let i in records3) {
        records3[i].lessCount = records3[i].partCount;
        this.peijianhuanshangjianSave(records3[i]);
      }
      // for (let i in data1.partRList) {
      //   this.$refs.table1.$refs.pageTable.list.map(x => {
      //     if (x.partCode == data1.partRList[i].partCode) {
      //       this.delsFunSj(x);
      //     }
      //   });
      // }
      this.sumAmount();
      if(this.formList1.find(x => x.fieldName == 'ifComm').initialValue == 55431001) {
        this.flag = false;
      }else{
        this.flag = true;
      }
      this.columnshuanxiajian.find(x => x.dataIndex == 'partCount').editable = false;
      this.columns1.find(x => x.dataIndex == 'partCount').editable = false;
      this.batchActivities = false;
    },
    sumAmount() {
      let sum = 0;
      this.$refs.table3.$refs.pageTable.list.map(x => {
        sum += Number(x.addAmount);
      });
      this.sumfujiafeiyongz = sum;
      this.$refs.table.$refs.pageTable.list.map(x => {
        sum += Number(x.cmsClaimAmount);
      });

      this.$refs.table1.$refs.pageTable.list.map(x => {
        sum += Number(x.cmsClaimAmount);
      });
      sum += this.feiyongformList.find(x => x.fieldName == 'helpAmount').initialValue;
      let realVal = parseFloat(sum).toFixed(2);
      this.feiyongformList.map(x => {
        if ('sumAmount' == x.fieldName) {
          x.initialValue = realVal;
        }
      });
    },
    async chuqi() {
      console.log('进来了');
      // const res = await getSupplierList();
      // if (res.resultCode == 200) {
      //   this.formList1.find(x => x.fieldName == 'supName').initialValue = '';
      //   this.formList1.find(x => x.fieldName == 'supName').itemList = res.data.map(y => ({ text: y.supName, value: y.supCode }));
      //   this.selects = res.data;
      // }
      // const res1 = await getPartType({ type: 5513 });
      // if (res1.resultCode == 200) {
      //   this.formList.find(x => x.fieldName == 'claimStatus').initialValue = '';
      //   this.formList.find(x => x.fieldName == 'claimStatus').itemList = res1.data.map(y => ({ text: y.codeCnDesc, value: y.codeId }));
      // }


      const res1 = await cmsClaimTypeStr({ type: 5510 });
      if (res1.resultCode == 200) {
        this.formList1.find(x => x.fieldName == 'cmsClaimType').itemList = res1.data.map(y => ({ text: y.codeCnDesc, value: y.codeId }));
      }

      // const res = await getWxlxSelect();
      // console.log(this.columns.find(x => x.dataIndex === 'cmsClaimType').dictItems);
      // this.columns.find(x => x.dataIndex === 'cmsClaimType').dictItems = res.data.map(x => ({
      //   value: x.REPAIR_TYPE_CODE + '',
      //   text: x.REPAIR_TYPE_NAME
      // }));
      //于诗瑶
      // const res3 = await getSysName1List();
      // console.log(res3,"333333333");
      // console.log(res3.data,"res3.datares3.datares3.data");
      // if (res3.resultCode == 200) {
      //   this.formList1.find(x => x.fieldName == 'sysName1').initialValue = '';
      //   this.formList1.find(x => x.fieldName == 'sysName1').itemList = res3.data.map(y => ({ text: y.sysName1, value: y.sysCode1 }));
      //   //{ text: y.sysName1, value: y.faultId }
      // }


      // const res3 = await getPartType({ type: 5543 });
      // if (res3.resultCode == 200) {
      //   this.formList1.find(x => x.fieldName == 'ifComm').initialValue = '';
      //   this.formList1.find(x => x.fieldName == 'ifComm').itemList = res3.data.map(y => ({ text: y.codeCnDesc, value: y.codeId }));
      // }
      // const res4 = await getPartType({ type: 1511 });
      // if (res4.resultCode == 200) {
      //   // delete res4.data[0];delete res4.data[2];delete res4.data[4];delete res4.data[6];delete res4.data[8];delete res4.data[10];delete res4.data[12];
      //   // delete res4.data[14];delete res4.data[16];delete res4.data[18];delete res4.data[20];delete res4.data[22]
      //   this.formList.find(x => x.fieldName == 'useType').initialValue = '';
      //   this.formList.find(x => x.fieldName == 'useType').itemList = res4.data.map(y => ({ text: y.codeCnDesc, value: y.codeId }));
      // }



      // const res5 = await getPartType({ type: 5585 });
      // console.log('$$$$$$$$$', this.columnshuanxiajian.find(x => x.dataIndex === 'returnType').dictItems);
      // this.columnshuanxiajian.find(x => x.dataIndex === 'returnType').dictItems = res5.data.map(x => ({
      //   value: x.codeId + '',
      //   text: x.codeCnDesc
      // }));

      // const res7 = await getPartType({ type: 5584 });
      // if (res7.resultCode === 200) {
      //   this.formList.find(x => x.fieldName == 'customerType').itemList = res7.data.map(y => ({ text: y.codeCnDesc, value: y.codeId }));
      // }

      // const res6 = await getPartType({ type: 5532 });
      // if (res6.resultCode === 200) {
      //   this.formList.find(x => x.fieldName == 'isSpecial').itemList = res6.data.map(y => ({ text: y.codeCnDesc, value: y.codeId }));
      // }
    },
    formChangeHandle(val) {
      this.saveData1 = val;
    },
    formChangeHandleSp(val) {
      this.saveData4 = val;
    },
    formChangeHandle2(val) {
      console.log(val);
      this.saveData3 = val;
    },
    //保存
    async saveDialog() {
      this.fileList = [];
      this.formList.find(x => x.fieldName == 'roNo').rules[0].required = false;
      // this.formList1.find(x => x.fieldName == 'sysName1').rules[0].required = false;
      // this.formList1.find(x => x.fieldName == 'sysName2').rules[0].required = false;
      // this.formList1.find(x => x.fieldName == 'sysName3').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'sysName4').rules[0].required = false;
      // this.formList1.find(x => x.fieldName == 'ifTrailer').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'cmsClaimType').rules[0].required = false;
      // this.formList1.find(x => x.fieldName == 'supName').rules[0].required = false;
      // this.formList1.find(x => x.fieldName == 'partCode').rules[0].required = false;
      // this.formList1.find(x => x.fieldName == 'ifComm').rules[0].required = false;
      // this.formList1.find(x => x.fieldName == 'faultCode').rules[0].required = false;
      // this.formList1.find(x => x.fieldName == 'faultName').rules[0].required = false;
      // this.formList1.find(x => x.fieldName == 'frCode').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'frName').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'faultAppear').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'faultReason').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'cmsClaimPgm').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'wayPicture').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'wayPicture1').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'wayPicture2').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'wayPicture3').rules[0].required = false;
      // this.formList1.find(x => x.fieldName == 'wayPicture4').rules[0].required  = false;
      // this.formList1.find(x => x.fieldName == 'wayPicture5').rules[0].required  = false;
      this.formList1.find(x => x.fieldName == 'selfNo').rules[0].required = false;
      // this.formList1.find(x => x.fieldName == 'selfSdate').rules[0].required  = false;
      // this.formList1.find(x => x.fieldName == 'selfUseMile').rules[0].required  = false;
      // this.formList1.find(x => x.fieldName == 'selfUseHours').rules[0].required  = false;
      // this.formList1.find(x => x.fieldName == 'selfMile').rules[0].required  = false;
      this.$refs.formPanel1.SUBMIT_FORM();
      this.$refs.formPanel2.SUBMIT_FORM();
      this.$refs.formPanel3.SUBMIT_FORM();
      let arr = [];
      this.$refs.table3.$refs.pageTable.list.map(x => {
        delete x.isDeleted;
        arr.push(x);
      });
      console.log(arr);

      let arr1 = [];
      this.$refs.table2.$refs.pageTable.list.map(x => {
        delete x.isDeleted;
        arr1.push(x);
      });
      console.log(arr1);

      let arr2 = [];
      this.$refs.table1.$refs.pageTable.list.map(x => {
        delete x.isDeleted;
        arr2.push(x);
      });
      console.log(arr2);

      let arr3 = [];
      this.$refs.table.$refs.pageTable.list.map(x => {
        delete x.isDeleted;
        arr3.push(x);
      });
      console.log(arr3);
      //维修项目
      this.saveData.labourList = arr3;
      //换上件
      this.saveData.partRList = arr2;
      //换下件
      this.saveData.partList = arr1;
      //附加项目
      this.saveData.addList = arr;

      this.saveData = Object.assign(this.saveData, this.saveData1);
      this.saveData = Object.assign(this.saveData, this.saveData4);
      this.saveData = Object.assign(this.saveData, this.saveData3);
      //保存前格式化时间类型
      //销售日期
      if (this.saveData.saleDate) {
        this.saveData.saleDate = moment(this.saveData.saleDate).format('YYYY-MM-DD HH:mm:ss');
      }
      //保修起始日期
      if (this.saveData.repairBeginDate) {
        this.saveData.repairBeginDate = moment(this.saveData.repairBeginDate).format('YYYY-MM-DD HH:mm:ss');
      }
      //维修开始时间
      if (this.saveData.serviceBeginDate) {
        this.saveData.serviceBeginDate = moment(this.saveData.serviceBeginDate).format('YYYY-MM-DD HH:mm:ss');
      }
      //维修结束时间
      if (this.saveData.serviceEndDate) {
        this.saveData.serviceEndDate = moment(this.saveData.serviceEndDate).format('YYYY-MM-DD HH:mm:ss');
      }
      //生产日期
      if (this.saveData.prodDate) {
        this.saveData.prodDate = moment(this.saveData.prodDate).format('YYYY-MM-DD HH:mm:ss');
      }
      // //自费备件销售日期
      if (this.saveData.selfSdate) {
        this.saveData.selfSdate = moment(this.saveData.selfSdate).format('YYYY-MM-DD HH:mm:ss');
      }

      this.saveData.fapaId  = this.fapaId;
      this.saveData.sysName1 = this.sysName1;
      this.saveData.claimId = this.rowData.claimId;
      this.saveData.partId = this.partId;
      this.saveData.supId = this.supId;
      this.saveData.supCode = this.supCode;
      this.saveData.modelId = this.modelId;
      this.saveData.modelCode = this.modelCode;
      this.saveData.faId = this.faId; //故障现象主键
      this.saveData.frId = this.frId; //故障原因主键
      this.saveData.outId = this.outId;
      this.saveData.isDeleted = this.isDeleted;
      this.saveData.outCode = this.outCode;
      this.saveData.claimNo = this.claimNo;
      this.saveData.recordVersion = this.rowData.recordVersion;
      this.saveData.ownerCode = this.rowData.ownerCode;
      this.saveData.ownerParCode = this.rowData.ownerParCode;
      this.saveData.appId = this.rowData.appId;
      this.saveData.createdAt = this.rowData.createdAt;
      this.saveData.createdBy = this.rowData.createdBy;
      this.saveData.orgId = this.rowData.orgId;
      this.saveData.submitAt = this.rowData.submitAt;
      this.saveData.applyBy = getUserId();
      this.saveData.applyAt = moment().format('YYYY-MM-DD HH:mm:ss');
      this.saveData.reportId = this.reportId;
      this.saveData.customerId = this.customerId;
      this.saveData.planAmount = this.planAmount;
      console.log('saveData::saveData::saveData::saveData::', this.saveData);
      let p1 = {
        title: this.saveData.wayPicture[0] == undefined ? null : this.saveData.wayPicture[0].name,
        fileUrl: this.saveData.wayPicture[0] == undefined ? null : this.saveData.wayPicture[0].url,
        type: 55141001
      };
      let p2 = {
        title: this.saveData.wayPicture1[0] == undefined ? null : this.saveData.wayPicture1[0].name,
        fileUrl: this.saveData.wayPicture1[0] == undefined ? null : this.saveData.wayPicture1[0].url,

        type: 55141002
      };
      let p3 = {
        title: this.saveData.wayPicture2[0] == undefined ? null : this.saveData.wayPicture2[0].name,
        fileUrl: this.saveData.wayPicture2[0] == undefined ? null : this.saveData.wayPicture2[0].url,
        type: 55141003
      };
      let p4 = {
        title: this.saveData.wayPicture3[0] == undefined ? null : this.saveData.wayPicture3[0].name,
        fileUrl: this.saveData.wayPicture3[0] == undefined ? null : this.saveData.wayPicture3[0].url,
        type: 55141004
      };
      let p5 = {
        title: this.saveData.wayPicture4[0] == undefined ? null : this.saveData.wayPicture4[0].name,
        fileUrl: this.saveData.wayPicture4[0] == undefined ? null : this.saveData.wayPicture4[0].url,
        type: 55141005
      };
      let p6 = {
        title: this.saveData.wayPicture5[0] == undefined ? null : this.saveData.wayPicture5[0].name,
        fileUrl: this.saveData.wayPicture5[0] == undefined ? null : this.saveData.wayPicture5[0].url,
        type: 55141006
      };
      this.fileList.push(p1);
      this.fileList.push(p2);
      this.fileList.push(p3);
      this.fileList.push(p4);
      this.fileList.push(p5);
      this.fileList.push(p6);
      this.$refs.fileTable.$refs.pageTable.list.map(x => {
        this.fileList.push(x);
      });
      this.saveData.fileList = this.fileList;
      this.loading = true;
      let res = await editSave(this.saveData);

      if (res.resultCode === 200) {
        this.$emit('save');
        return this.$notify.success({ title: '提示信息', message: '保存成功' });
      } else {
        this.loading = false;
      }
      this.loading = false;
    },
    async detail() {
      if (this.rescueNo) {
        this.formData.rescueNo = this.rescueNo;
        this.formData.ownerCode = getOwnerCode();
        const res = await getResultList({ rescueNo: this.rescueNo, ownerCode: getOwnerCode() });
        let val = res.data.rows[0];
        this.formData = val;
        this.actions = { type: 'edit', visible: true, title: '外出救援' };
      } else {
        this.$notify.error({ title: '提示信息', message: '请选择救援单号' });
      }
    },
    close() {
      // 关闭
      this.actions.visible = false;
    },
    selfCode(val) {
      this.formList1.map(y => {
        if (y.fieldName == 'selfNo') {
          y.hidden = true;
          y.initialValue = undefined;
        }
        if (y.fieldName == 'selfSdate') {
          y.hidden = true;
          y.initialValue = undefined;
        }
        if (y.fieldName == 'selfUseMile') {
          y.hidden = true;
          y.initialValue = undefined;
        }
        if (y.fieldName == 'selfUseHours') {
          y.hidden = true;
          y.initialValue = undefined;
        }
        if (y.fieldName == 'selfMile') {
          y.hidden = true;
          y.initialValue = undefined;
        }
        if (y.fieldName == 'cmsClaimType') {
          y.initialValue = val;
        }
        if (y.fieldName == 'authNo') {
          y.rules[0].required = false;
        }
        if (y.fieldName == 'batchCode') {
          y.disabled = true;
          y.rules[0].required = false;
          y.initialValue = '';
        }
        if (y.fieldName == 'batchName') {
          y.initialValue = '';
        }
      });
    },
    delsFun(data) {
      this.$refs.table.$refs.pageTable.EXECUTE_DELETE([data]);
      this.feiyongformList.map(x => {
        if ('labourAmount' == x.fieldName) {
          x.initialValue = parseFloat(this.sumweixiufeiyongz - Number(data.cmsClaimAmount)).toFixed(2);
          this.sumweixiufeiyongz = x.initialValue;
          this.sumAmount();
        }
      });
    },
    delsFunSj(data) {
      this.$refs.table1.$refs.pageTable.EXECUTE_DELETE([data]);
      this.feiyongformList.map(x => {
        if ('partAmount' == x.fieldName) {
          x.initialValue = parseFloat(this.partAmountsumz - Number(data.cmsClaimAmount)).toFixed(2);
          this.partAmountsumz = x.initialValue;
          this.sumAmount();
        }
      });
      this.$refs.table2.$refs.pageTable.list.map(x => {
        if (data.partCode == x.partCode) {
          this.$refs.table2.$refs.pageTable.EXECUTE_DELETE([x]);
        }
      });
    },
    delsFunXj(data){
       this.ysy = data;
       this.peijianhuanxiajianlistchangeflag = true;

    },
    delsFunXjf(data) {
      this.$refs.table2.$refs.pageTable.EXECUTE_DELETE([data]);
    },
    delsFunFj(data) {
      this.$refs.table3.$refs.pageTable.EXECUTE_DELETE([data]);
      this.feiyongformList.map(x => {
        if ('addAmount' == x.fieldName) {
          x.initialValue = parseFloat(this.sumfujiafeiyongz - Number(data.addAmount)).toFixed(2);
          this.sumfujiafeiyongz = x.initialValue;
          this.sumAmount();
        }
      });
    },
    saveFile(obj) {
      let list = this.$refs.table3.$refs.pageTable.list;
      list.find(x => x.addCode == obj.addCode).addFiles = obj.length == 0 ? [] : obj;
      this.upVisible = false;
    },
    editFile(row) {
      this.upVisible = true;
      this.uploadDate = row;
      this.uploadDate.claimId = this.rowData.claimId;
    },
    suppliersClose() {
      this.suppliers = false;
    },
    suppliersSave(obj) {
      this.formList1.find(x => x.fieldName == 'supName').initialValue = obj[0].supName;
      this.supCode = obj[0].supCode;
      this.supId = obj[0].supId;
      this.suppliers = false;
    },
    selectSuppliersCode() {
      this.suppliers = true;
    },
    //搜索获取数据
    changeHandle(val) {
      this.fetchParams = val;
      console.log(val);
    },
    //选中
    selectChange(rows) {
      this.selectedRows = rows;
      console.log(this.selectedRows);
    },
    //维修项目列表新增
    weixiuxiangmulistadd() {
      this.weixiuxiangmulistaddflag = true;
    },
    //备件换上件列表
    peijianhuanshangjianadd() {
      this.peijianhuanshangjianlistaddflag = true;
    },
    peijianhuanshangjianlistadd() {
      this.peijianhuanshangjianlistaddflag = true;
    },
    //备件换下件列表
    peijianhuanxiajianadd() {
      this.peijianhuanxiajianlistaddflag = true;
    },
    //附加项目列表
    fujiaxiangmuadd() {
      this.fujiaxiangmulistaddflag = true;
    },
    //维修工单
    weixiugongdanClose() {
      this.weixiugongdan = false;
    },
    //质量报告单
    reportClose() {
      this.reportFlag = false;
    },
    //救援单号
    jiuyuandanhaoClose() {
      this.jiuyuandanhao = false;
    },
    jiuyuandanhaoSave(obj) {
      this.formList1.find(x => x.fieldName == 'outNo').initialValue = obj[0].rescueNo;
      this.rescueNo = obj[0].rescueNo;
      this.feiyongformList.map(x => {
        if ('helpAmount' == x.fieldName) {
          x.initialValue = Number(obj[0].sumAmount);
        }
      });
      this.sumAmount();
      this.jiuyuandanhao = false;
    },
    //主损件
    zhusunjianClose() {
      this.zhusunjian = false;
    },
    //故障现象
    guzhangxianxiangdaimanClose() {
      this.guzhangxianxiangdaima = false;
    },
    guzhangxianxiangdaimaSave(obj) {
      // this.formList1.find(x => x.fieldName == 'sysCode1').initialValue = obj[0].sysCode1;
      // this.formList1.find(x => x.fieldName == 'sysName1').initialValue = obj[0].sysName1;
      // this.formList1.find(x => x.fieldName == 'sysCode2').initialValue = obj[0].sysCode2;
      // this.formList1.find(x => x.fieldName == 'sysName2').initialValue = obj[0].sysName2;
      // this.formList1.find(x => x.fieldName == 'sysCode3').initialValue = obj[0].sysCode3;
      // this.formList1.find(x => x.fieldName == 'sysName3').initialValue = obj[0].sysName3;
      // this.formList1.find(x => x.fieldName == 'sysCode4').initialValue = obj[0].sysCode4;
      this.formList1.find(x => x.fieldName == 'sysName4').initialValue = obj[0].sysName4;
      this.formList1.find(x => x.fieldName == 'faultCode').initialValue = obj[0].faultCode;
      this.formList1.find(x => x.fieldName == 'faultName').initialValue = obj[0].faultName;
      this.faId = obj[0].faultId;
      this.guzhangxianxiangdaima = false;
    },
    //故障原因
    guzhangyuanyinClose() {
      this.guzhangyuanyin = false;
    },
    guzhangyuanyinSave(obj) {
      this.formList1.find(x => x.fieldName == 'frCode').initialValue = obj[0].frCode;
      this.formList1.find(x => x.fieldName == 'frName').initialValue = obj[0].frName;
      this.frId = obj[0].frId;
      this.guzhangyuanyin = false;
    },
    //自费工单
    zifeigongdanClose() {
      this.zifeigongdan = false;
    },
    zifeigongdanSave(obj) {
      this.formList1.find(x => x.fieldName == 'selfNo').initialValue = obj[0].selfNo;
      this.formList1.find(x => x.fieldName == 'selfSdate').initialValue = obj[0].selfSdate;
      this.formList1.find(x => x.fieldName == 'selfMile').initialValue = obj[0].selfMile;
      this.formList1.find(x => x.fieldName == 'selfUseHours').initialValue = obj[0].selfUseHours;
      this.formList1.find(x => x.fieldName == 'selfUseMile').initialValue = obj[0].selfUseMile;
      this.zifeigongdan = false;
    },
    //维修项目
    weixiuxiangmulistClose() {
      this.weixiuxiangmulistaddflag = false;
    },
    weixiuxiangmulistSave2(val) {
      let data = {};
      let falg = true;
      data.cmsClaimAmount = val[0].cmsClaimAmount;
      data.cmsClaimPrice = val[0].cmsClaimPrice;
      data.cmsClaimType = val[0].cmsClaimType;
      data.labourCode = val[0].labourCode;
      data.labourHours = val[0].labourHours;
      data.labourName = val[0].labourName;
      this.$refs.table.$refs.pageTable.list.map(x => {
        if (data.labourCode == x.labourCode) {
          falg = false;
          this.$notify.error({ title: '提示信息', message: '维修项目选择重复' });
        }
      });

      console.log(val);
      if (falg) {
        this.$refs.table.$refs.pageTable.EXECUTE_INSERT(data);
      }
      let sumweixiufeiyong = 0;
      this.$refs.table.$refs.pageTable.list.map(x => {
        sumweixiufeiyong += Number(x.cmsClaimAmount);
      });
      let realVal = parseFloat(sumweixiufeiyong).toFixed(2);
      this.feiyongformList.map(x => {
        if ('labourAmount' == x.fieldName) {
          x.initialValue = realVal;
        }
      });
      this.sumweixiufeiyongz = sumweixiufeiyong;
      this.sumAmount();
      this.weixiuxiangmulistaddflag = false;
    },
    weixiuxiangmulistSave(val) {
      // let falg = true;
      // this.$refs.table.$refs.pageTable.list.map((x) => {
      //   console.log("val",val.labourCode)
      //   console.log("val",x.labourCode)
      //   if (val[0].labourCode == x.labourCode) {
      //     falg = false;
      //     this.$notify.error({ title: '提示信息', message: '维修项目选择重复' });
      //   }
      // });
      // if (falg) {
      this.$refs.table.$refs.pageTable.EXECUTE_INSERT(val);
      // }
      let sumweixiufeiyong = 0;
      this.$refs.table.$refs.pageTable.list.map(x => {
        sumweixiufeiyong += Number(x.cmsClaimAmount);
      });
      let realVal = parseFloat(sumweixiufeiyong).toFixed(2);
      this.feiyongformList.map(x => {
        if ('labourAmount' == x.fieldName) {
          x.initialValue = realVal;
        }
      });
      this.sumweixiufeiyongz = sumweixiufeiyong;
      this.sumAmount();
      this.weixiuxiangmulistaddflag = false;
    },

    //备件换上件
    peijianhuanshangjianClose() {
      this.peijianhuanshangjianlistaddflag = false;
    },
    fujiaxiangmuCloseSave() {
      this.fujiaxiangmuCloselistaddflag = false;
      this.fetchParams = { ...this.fetchParams };
    },
    //附加项目
    fujiaxiangmuClose() {
      this.fujiaxiangmulistaddflag = false;
    },
    fujiaxiangmuSave(val) {
      let data = {};
      // let falg = true;
      data.addCode = val.addCode;
      data.addName = val.addName;
      data.addAmount = val.addAmount;
      data.remarks = val.remarks;
      // this.$refs.table3.$refs.pageTable.list.map((x) => {
      //   if (data.addCode == x.addCode) {
      //     falg = false;
      //     this.$notify.error({ title: '提示信息', message: '附加项目选择重复' });
      //   }
      // });
      // if (falg) {
      this.$refs.table3.$refs.pageTable.EXECUTE_INSERT(data);
      // }

      let sumfujiafeiyong = 0;
      this.$refs.table3.$refs.pageTable.list.map(x => {
        sumfujiafeiyong += Number(x.addAmount);
      });
      let realVal = parseFloat(sumfujiafeiyong).toFixed(2);
      this.feiyongformList.map(x => {
        if ('addAmount' == x.fieldName) {
          x.initialValue = realVal;
        }
      });
      this.sumfujiafeiyongz = sumfujiafeiyong;
      this.sumAmount();
      this.fujiaxiangmulistaddflag = false;
    },

    //备件换上件
    fujiaxiangmuCloseClose() {
      this.fujiaxiangmuCloselistaddflag = false;
    },
    peijianhuanshangjianSave(val) {
      // let falg = true;
      // this.$refs.table1.$refs.pageTable.list.map((x) => {
      //   if (val.partCode == x.partCode) {
      //     falg = false;
      //     this.$notify.error({ title: '提示信息', message: '备件'+x.partCode+'选择重复' });
      //   }
      // });
      // if (falg) {
      this.$refs.table1.$refs.pageTable.EXECUTE_INSERT(val);
      // }
      let partAmountsum = 0;
      this.$refs.table1.$refs.pageTable.list.map(x => {
        this.sumAmountsum += Number(x.cmsClaimAmount);
        partAmountsum += Number(x.cmsClaimAmount);
      });
      let realVal = parseFloat(partAmountsum).toFixed(2);
      this.feiyongformList.map(x => {
        if ('partAmount' == x.fieldName) {
          x.initialValue = realVal;
        }
      });
      this.partAmountsumz = partAmountsum;
      this.sumAmount();
      this.peijianhuanshangjianlistaddflag = false;
    },
    peijianhuanshangjianSave2(val) {
      let falg = true;
      this.$refs.table1.$refs.pageTable.list.map(x => {
        if (val[0].partCode == x.partCode) {
          falg = false;
          this.$notify.error({ title: '提示信息', message: '备件' + x.partCode + '选择重复' });
        }
      });
      if (falg) {
        this.$refs.table1.$refs.pageTable.EXECUTE_INSERT(val);
        this.$refs.table2.$refs.pageTable.EXECUTE_INSERT(val);
      }
      let partAmountsum = 0;
      this.$refs.table1.$refs.pageTable.list.map(x => {
        this.sumAmountsum += Number(x.cmsClaimAmount);
        partAmountsum += Number(x.cmsClaimAmount);
      });
      let realVal = parseFloat(partAmountsum).toFixed(2);
      this.feiyongformList.map(x => {
        if ('partAmount' == x.fieldName) {
          x.initialValue = realVal;
        }
      });
      this.partAmountsumz = partAmountsum;
      this.sumAmount();
      this.peijianhuanshangjianlistaddflag = false;
    },
    //备件换下件
    peijianhuanxiajianClose() {
      this.peijianhuanxiajianlistaddflag = false;
      this.peijianhuanxiajianlistchangeflag = false;
    },
    peijianhuanxiajianSave5(val) {
      let values = [];
      val.map(v => {
        if(!this.$refs.table2.$refs.pageTable.list.find(x => x.partCode == v.partCode)){
          if(!v.partCount){
            v.partCount=1;
          }
          values.push(v);
        }else{
          this.$notify.error({ title: '提示信息', message: '该备件代码已添加:'+v.partCode });
        }
      });
      // let falg = true ;
      //   this.$refs.table2.$refs.pageTable.list.map(x => {
      //       if (val.partCode == x.partCode) {
      //         falg = false;
      //         this.$notify.error({title: '提示信息', message: '备件选择重复'});
      //       }
      //   });
      //   if (falg) {
      this.$refs.table2.$refs.pageTable.EXECUTE_INSERT(values);
      // }
      this.peijianhuanxiajianlistaddflag = false;
    },
    async peijianhuanxiajianSave(val) {
      this.claimPart = {};
      this.claimPart.partList = val;
      let res = await getCliamPart(this.claimPart);
      let values = [];
      //ysy 注释 11.5 15：31
      // res.data.map(v => {
      //   if (!this.$refs.table2.$refs.pageTable.list.find(x => x.partCode == v.partCode)) {
      //     v.partCount = 1;
      //     values.push(v);
      //     this.delsFunXjf(this.ysy);
      //   } else {
      //     this.$notify.error({ title: '提示信息', message: '该备件代码已添加:' + v.partCode });
      //   }
      // });
      this.$refs.table2.$refs.pageTable.list.map(x => {
        if (x.partCode !== res.data[0].partCode) {
          res.data[0].partCount = this.ysy.partCount;
          res.data[0].partCodeBefore = this.ysy.partCode;
          res.data[0].partNameBefore = this.ysy.partName;
          if(x.partCode == this.ysy.partCode){
            values.push(res.data[0]);
            this.delsFunXjf(this.ysy);
          }
        }else{
          this.$notify.error({ title: '提示信息', message: '该备件代码已添加:' + res.data[0].partCode });
        }
      });

      // let falg = true ;
      //   this.$refs.table2.$refs.pageTable.list.map(x => {
      //       if (val.partCode == x.partCode) {
      //         falg = false;
      //         this.$notify.error({title: '提示信息', message: '备件选择重复'});
      //       }
      //   });
      //   if (falg) {
      this.$refs.table2.$refs.pageTable.EXECUTE_INSERT(values);
      // }
      this.peijianhuanxiajianlistaddflag = false;
      this.peijianhuanxiajianlistchangeflag = false;
    },
    peijianhuanxiajianSave2(val) {
      this.$refs.table2.$refs.pageTable.EXECUTE_INSERT(val);
      // }
      this.peijianhuanxiajianlistaddflag = false;
    },
    //取消操作
    closeDialog() {
      this.$emit('close', { visible: false, data: this.selectedRows, type: 'close' });
    },
    chooseOrderNo() {
      this.visible = true;
    }, //维修工单号选择
    selectRono() {
      this.weixiugongdan = true;
    },
    selectpartCode() {
      this.zhusunjian = true;
    },
    selectYsqCode() {
      this.yushouquan = true;
    },
    selectfaultCode() {
      this.guzhangxianxiangdaima = true;
    },
    selectfaultReason() {
      this.guzhangyuanyin = true;
    },
    selectReportNo() {
      this.reportFlag = true;
    },
    reportSave(obj) {
      this.formList1.find(x => x.fieldName == 'reportNo').initialValue = obj[0].reportNo;
      this.reportId = obj[0].reportId;
      this.reportFlag = false;
    },
    selectOutNo() {
      this.jiuyuandanhao = true;
      if (this.rowDate.vin) {
        this.helpVin = this.rowDate.vin;
      }
    },
    selectselfNo() {
      if (this.rowDate.vin) {
        this.zifeigongdan = true;
      } else {
        this.$notify.error({ title: '提示信息', message: '请选择维修工单' });
      }
    },
    yushouquanClose() {
      this.yushouquan = false;
    },
    yushouquanSave(obj) {
      this.formList1.find(x => x.fieldName == 'authNo').initialValue = obj[0].authNo;
      this.formList1.find(x => x.fieldName == 'partCode').initialValue = obj[0].partCode;
      this.formList1.find(x => x.fieldName == 'partName').initialValue = obj[0].partName;
      this.formList1.find(x => x.fieldName == 'sysCode1').initialValue = obj[0].sysCode1;
      this.formList1.find(x => x.fieldName == 'sysName1').initialValue = obj[0].sysName1;
      this.formList1.find(x => x.fieldName == 'sysCode2').initialValue = obj[0].sysCode2;
      this.formList1.find(x => x.fieldName == 'sysName2').initialValue = obj[0].sysName2;
      this.formList1.find(x => x.fieldName == 'sysCode3').initialValue = obj[0].sysCode3;
      this.formList1.find(x => x.fieldName == 'sysName3').initialValue = obj[0].sysName3;
      this.formList1.find(x => x.fieldName == 'sysCode4').initialValue = obj[0].sysCode4;
      this.formList1.find(x => x.fieldName == 'sysName4').initialValue = obj[0].sysName4;
      this.formList1.find(x => x.fieldName == 'faultCode').initialValue = obj[0].faultCode;
      this.formList1.find(x => x.fieldName == 'faultName').initialValue = obj[0].faultName;
      this.faId = obj[0].faId;
      this.formList1.find(x => x.fieldName == 'frCode').initialValue = obj[0].frCode;
      this.formList1.find(x => x.fieldName == 'frName').initialValue = obj[0].frName;
      this.frId = obj[0].frId;
      this.formList1.find(x => x.fieldName == 'faultAppear').initialValue = obj[0].faultAppear;
      this.formList1.find(x => x.fieldName == 'faultReason').initialValue = obj[0].faultReason;
      this.formList1.find(x => x.fieldName == 'cmsClaimPgm').initialValue = obj[0].cmsClaimPgm;
      this.formList1.find(x => x.fieldName == 'supName').initialValue = obj[0].supName;
      this.supCode = obj[0].supCode;
      this.supId = obj[0].supId;
      this.yushouquan = false;

    },
    add() {},
    async weixiugongdanSave(obj) {
      this.loading = true;
      this.menus[2].params.roNo = obj[0].vin;
      this.menus[1].params.vin = obj[0].vin;
      // this.formList.find((x) => x.fieldName == 'claimNo').initialValue = obj[0].claimNo;
      this.formList.find(x => x.fieldName == 'roNo').initialValue = obj[0].roNo;
      // this.formList.find(x => x.fieldName == 'claimStatus').initialValue = obj[0].claimStatus;
      this.formList.find(x => x.fieldName == 'vin').initialValue = obj[0].vin;
      this.formList.find(x => x.fieldName == 'licenseNo').initialValue = obj[0].licenseNo;
      this.formList.find(x => x.fieldName == 'modelName').initialValue = obj[0].modelName;
      this.formList.find(x => x.fieldName == 'saleDate').initialValue = obj[0].saleDate != null ? moment(obj[0].saleDate).format('YYYY-MM-DD') : null;
      this.formList.find(x => x.fieldName == 'repairBeginDate').initialValue = obj[0].repairBeginDate != null ? moment(obj[0].repairBeginDate).format('YYYY-MM-DD') : null;
      this.formList.find(x => x.fieldName == 'serviceBeginDate').initialValue = obj[0].serviceBeginDate;
      this.formList.find(x => x.fieldName == 'serviceEndDate').initialValue = obj[0].serviceEndDate;
      this.formList.find(x => x.fieldName == 'prodDate').initialValue = obj[0].prodDate != null ? moment(obj[0].prodDate).format('YYYY-MM-DD') : null;
      this.formList.find(x => x.fieldName == 'driveMile').initialValue = obj[0].driveMile;
      this.formList.find(x => x.fieldName == 'customerName').initialValue = obj[0].customerName;
      this.formList.find(x => x.fieldName == 'customerPhone').initialValue = obj[0].customerPhone;
      this.formList.find(x => x.fieldName == 'serviceName').initialValue = obj[0].serviceName;
      this.formList.find(x => x.fieldName == 'servicePhone').initialValue = obj[0].servicePhone;
      this.formList.find(x => x.fieldName == 'applyName').initialValue = obj[0].applyName;
      this.formList.find(x => x.fieldName == 'applyPhone').initialValue = obj[0].applyPhone;
      this.formList.find(x => x.fieldName == 'useType').initialValue = obj[0].useType;

      let res = await translateByVinAndModelCode({
        vin: obj[0].VIN,
        modelCode: obj[0].MODEL_CODE,
        customerType: obj[0].BUSINESS_KIND
      });

      if (res.data.customerType != null) {
        this.formList.find(x => x.fieldName == 'customerType').initialValue = Number(res.data.customerType);
      } else {
        this.formList.find(x => x.fieldName == 'customerType').initialValue = res.data.customerType;
      }
      if (res.data.isSpecial != null) {
        this.formList.find(x => x.fieldName == 'isSpecial').initialValue = Number(res.data.isSpecial);
      } else {
        this.formList.find(x => x.fieldName == 'isSpecial').initialValue = res.data.isSpecial;
      }

      // this.modelCode = obj[0].modelCode;
      this.modelId = obj[0].modelId;
      // this.customerId = obj[0].customerNo;
      this.rowDate = obj[0];
      this.weixiugongdan = false;
      this.formList1.map(y => {
        if (y.fieldName == 'selfNo') {
          y.hidden = true;
        }
        if (y.fieldName == 'selfSdate') {
          y.hidden = true;
        }
        if (y.fieldName == 'selfUseMile') {
          y.hidden = true;
        }
        if (y.fieldName == 'selfUseHours') {
          y.hidden = true;
        }
        if (y.fieldName == 'selfMile') {
          y.hidden = true;
        }
        if (y.fieldName == 'cmsClaimType') {
          y.initialValue = '';
          y.disabled = false;
        }
        if (y.fieldName == 'authNo') {
          y.rules[0].required = false;
        }
        if (y.fieldName == 'batchCode') {
          y.disabled = true;
          y.rules[0].required = false;
          y.initialValue = '';
        }
        if (y.fieldName == 'batchName') {
          y.initialValue = '';
        }
      });
      // if(obj[0].REPAIR_TYPE_CODE == "0" ){
      //   this.formList1.find(x => x.fieldName == 'cmsClaimType').initialValue = 55011006;
      //   this.formList1.find(x => x.fieldName == 'cmsClaimType').disabled = true;
      // }else if(obj[0].REPAIR_TYPE_CODE == "1"){
      //   this.formList1.find(x => x.fieldName == 'cmsClaimType').initialValue = 55011007;
      //   this.formList1.find(x => x.fieldName == 'cmsClaimType').disabled = true;
      // }
      await this.queryRepair(obj[0].roNo);
      await this.queryModel(this.modelCode);
      this.dataVin = obj[0].VIN;
      console.log('sdasdaddddddd',this.dataVin)
      this.flag = false;
      this.loading = false;
    },
    async queryModel(modelCode) {
      let res = await queryModelDetail({ modelCode: modelCode });
      if (res.data.powerType == '60081002') {
        this.formList1.find(x => x.fieldName == 'ifComm').initialValue = 55431002;
      } else if (res.data.powerType == '60081001') {
        this.formList1.find(x => x.fieldName == 'ifComm').initialValue = 55431001;
      }
    },
    async queryRepair(roNo) {
      let res = await queryRepairDetail({ roNo: roNo });
      let res1 = await queryPreClaimLog({ roNo: roNo, id: this.rowData.claimId });
      let data = res.data;
      let data1 = res1.data;
      this.modelCode = res.data.modelCode;
      this.customerId = res.data.customerNo;
      this.formList.find(x => x.fieldName == 'applyName').initialValue = res.data.applyName;
      this.formList.find(x => x.fieldName == 'applyPhone').initialValue = res.data.applyPhone;
      this.flag = false;
      this.columnshuanxiajian.find(x => x.dataIndex == 'partCount').editable = false;
      // this.columns1.find(x=>x.dataIndex=='partCount').editable=true;
      if (isFormEmpty(data)) {
        data = {};
      }
      data.partList.map(x => {
        x.lessCount = x.partCount;
      });
      let records = data.labourList;
      if (isFormEmpty(records)) {
        records = [];
      }
      this.$refs.table.$refs.pageTable.EXECUTE_DELETE(this.$refs.table.$refs.pageTable.list);
      this.feiyongformList.map(x => {
        if ('labourAmount' == x.fieldName) {
          x.initialValue = 0;
          this.sumAmount();
        }
      });
      for (let i in records) {
        if (records[i].isUseSetMealPackage != '10041001') {
          this.weixiuxiangmulistSave(records[i]);
        }
      }
      for (let i in data1.labourList) {
        this.$refs.table.$refs.pageTable.list.map(x => {
          if (x.labourCode == data1.labourList[i].labourCode) {
            this.delsFun(x);
          }
        });
      }
      let arr = [];
      this.$refs.table.$refs.pageTable.list.map(x => {
        arr.push(x);
      });
      this.finalLabourList = arr;
      let records1 = data.addList;
      if (isFormEmpty(records1)) {
        records1 = [];
      }
      this.$refs.table3.$refs.pageTable.EXECUTE_DELETE(this.$refs.table3.$refs.pageTable.list);
      this.feiyongformList.map(x => {
        if ('addAmount' == x.fieldName) {
          x.initialValue = 0;
          this.sumAmount();
        }
      });

      for (let i in records1) {
        if (records1[i].isUseSetMealPackage != '10041001') {
          this.fujiaxiangmuSave(records1[i]);
        }
      }
      for (let i in data1.addList) {
        this.$refs.table3.$refs.pageTable.list.map(x => {
          if (x.addCode == data1.addList[i].addCode) {
            this.delsFunFj(x);
          }
        });
      }
      let records2 = data.partList;
      if (isFormEmpty(records2)) {
        records2 = [];
      }
      this.$refs.table2.$refs.pageTable.EXECUTE_DELETE(this.$refs.table2.$refs.pageTable.list);

      for (let i in records2) {
        if (records2[i].isUseSetMealPackage != '10041001') {
          this.peijianhuanxiajianSave2(records2[i]);
        }
      }
      for (let i in data1.partList) {
        this.$refs.table2.$refs.pageTable.list.map(x => {
          if(x.partCode==data1.partList[i].partCode){
            x.lessCount = Number(x.partCount)-Number(data1.partList[i].partCount==null?0:data1.partList[i].partCount);
            x.partCount = x.lessCount
            this.$refs.table2.$refs.pageTable.EXECUTE_DELETE([x]);
          }
        })
      }

      // for (let i in data1.partList) {
      //   this.$refs.table2.$refs.pageTable.list.map(x => {
      //     if(x.partCode==data1.partList[i].partCode){
      //       this.$refs.table2.$refs.pageTable.EXECUTE_DELETE([x]);
      //     }
      //   })
      // }
      let records3 = data.partList;
      if (isFormEmpty(records3)) {
        records3 = [];
      }
      this.$refs.table1.$refs.pageTable.EXECUTE_DELETE(this.$refs.table1.$refs.pageTable.list);
      this.feiyongformList.map(x => {
        if ('partAmount' == x.fieldName) {
          x.initialValue = 0;
          this.sumAmount();
        }
      });
      for (let i in records3) {
        if (records3[i].isUseSetMealPackage != '10041001') {
          this.peijianhuanshangjianSave(records3[i]);
        }
      }
      for (let i in data1.partRList) {
        this.$refs.table1.$refs.pageTable.list.map(x => {
          if (x.partCode == data1.partRList[i].partCode) {
            x.lessCount = Number(x.partCount) - Number(data1.partRList[i].partCount == null ? 0 : data1.partRList[i].partCount);
            x.partCount = x.lessCount;
            x.cmsClaimAmount = parseFloat(x.cmsClaimPrice * x.partCount).toFixed(2);
            // this.delsFunSj(x)
          }
        });
      }
      let partAmountsum = 0;
      this.$refs.table1.$refs.pageTable.list.map(x => {
        this.sumAmountsum += Number(x.cmsClaimAmount);
        partAmountsum += Number(x.cmsClaimAmount);
      });
      let realVal = parseFloat(partAmountsum).toFixed(2);
      this.feiyongformList.map(x => {
        if ('partAmount' == x.fieldName) {
          x.initialValue = realVal;
        }
      });
      this.partAmountsumz = partAmountsum;
      this.changeCells();
    },
    async zhusunjianSave(obj) {
      this.formList1.find(x => x.fieldName == 'partCode').initialValue = obj[0].partCode;
      this.formList1.find(x => x.fieldName == 'partName').initialValue = obj[0].partName;
      this.partId = obj[0].partId;
      this.rowDate.partCode = obj[0].partCode;
      this.formList1.find(x => x.fieldName == 'supName').initialValue = '';
      if( this.formList1.find(x => x.fieldName == 'ifComm').initialValue){
        if( this.formList1.find(x => x.fieldName == 'ifComm').initialValue  == 55431001){
          this.rowDate.ydsx = 50001001;
        }else{
          this.rowDate.ydsx = 50001002;
        }
      }
      const res = await getSupplierList({ appId: getAppId(), bjxmbh: this.rowDate.partCode,bjpjsx:this.rowDate.ydsx  });
      if (res.resultCode == 200) {
        res.data.records.map(x => {
          x.supCode = x.bjgybm;
          x.supId = x.id;
          x.supName = x.bjgyjc;
        });
        if (res.data.records.length == 1) {
          this.suppliersSave(res.data.records);
        } else if (res.data.records.length == 0) {
          this.rowDate.partCode = '';
        }
      }
      this.zhusunjian = false;
      this.changeFaultSelect();
    },
    async submit() {
      // if(this.formList1.find(x => x.fieldName == 'ifComm').initialValue == 55431001){
      //   this.formList1.find(x => x.fieldName == 'wayPicture3').rules[0].required = false;
      //   if( !this.$refs.fileTable.$refs.pageTable.list.length){
      //    return this.$notify.error({ title: '提示信息', message: '保存失败,请检查视频/压缩文件、维修项目、换上件、附加项目是否存在和必填项!' });
      //   }
      // }
      debugger;
      this.fileList = [];
      this.saveFlag = 1;
      this.$refs.formPanel1.SUBMIT_FORM();
      this.$refs.formPanel2.SUBMIT_FORM();
      this.$refs.formPanel3.SUBMIT_FORM();
      let arr = [];
      this.$refs.table3.$refs.pageTable.list.map(x => {
        delete x.isDeleted;
        arr.push(x);
        this.acData.addList.map(y => {
          if (x.addAmount != y.addAmount) {
            this.columnsfujiaxiangmu.find(x => x.dataIndex == 'remarks').editRequired = true;
          }
        });
      });
      console.log(arr);

      let arr1 = [];
      this.$refs.table2.$refs.pageTable.list.map(x => {
        delete x.isDeleted;
        arr1.push(x);
      });
      console.log(arr1);

      let arr2 = [];
      this.$refs.table1.$refs.pageTable.list.map(x => {
        delete x.isDeleted;
        arr2.push(x);
      });
      console.log(arr2);

      let arr3 = [];
      this.$refs.table.$refs.pageTable.list.map(x => {
        delete x.isDeleted;
        arr3.push(x);
      });
      console.log(arr3);
      //维修项目
      this.saveData.labourList = arr3;
      //换上件
      this.saveData.partRList = arr2;
      //换下件
      this.saveData.partList = arr1;
      //附加项目
      this.saveData.addList = arr;

      this.saveData = Object.assign(this.saveData, this.saveData1);
      this.saveData = Object.assign(this.saveData, this.saveData4);
      this.saveData = Object.assign(this.saveData, this.saveData3);
      //判断是保存还是提交 默认0 提交1

      this.saveData.claimStatus = 55131002;
      //保存前格式化时间类型
      //销售日期
      if (this.saveData.saleDate) {
        this.saveData.saleDate = moment(this.saveData.saleDate).format('YYYY-MM-DD HH:mm:ss');
      }
      //保修起始日期
      if (this.saveData.repairBeginDate) {
        this.saveData.repairBeginDate = moment(this.saveData.repairBeginDate).format('YYYY-MM-DD HH:mm:ss');
      }
      //维修开始时间
      if (this.saveData.serviceBeginDate) {
        this.saveData.serviceBeginDate = moment(this.saveData.serviceBeginDate).format('YYYY-MM-DD HH:mm:ss');
      }
      //维修结束时间
      if (this.saveData.serviceEndDate) {
        this.saveData.serviceEndDate = moment(this.saveData.serviceEndDate).format('YYYY-MM-DD HH:mm:ss');
      }
      //生产日期
      if (this.saveData.prodDate) {
        this.saveData.prodDate = moment(this.saveData.prodDate).format('YYYY-MM-DD HH:mm:ss');
      }
      if (this.saveData.selfSdate) {
        this.saveData.selfSdate = moment(this.saveData.selfSdate).format('YYYY-MM-DD HH:mm:ss');
      }
      this.saveData.claimId = this.rowData.claimId;
      this.saveData.partId = this.partId;
      this.saveData.supId = this.supId;
      this.saveData.supCode = this.supCode;
      this.saveData.modelId = this.modelId;
      this.saveData.modelCode = this.modelCode;
      this.saveData.faId = this.faId; //故障现象主键
      this.saveData.frId = this.frId; //故障原因主键
      this.saveData.outId = this.outId;
      this.saveData.isDeleted = this.isDeleted;
      this.saveData.outCode = this.outCode;
      this.saveData.claimNo = this.claimNo;
      this.saveData.appId = this.rowData.appId;
      this.saveData.createdAt = this.rowData.createdAt;
      this.saveData.createdBy = this.rowData.createdBy;
      this.saveData.recordVersion = this.rowData.recordVersion;
      this.saveData.ownerCode = this.rowData.ownerCode;
      this.saveData.ownerParCode = this.rowData.ownerParCode;
      this.saveData.submitAt = this.rowData.submitAt;
      this.saveData.orgId = this.rowData.orgId;
      this.saveData.applyBy = getUserId();
      this.saveData.applyAt = moment().format('YYYY-MM-DD HH:mm:ss');
      this.saveData.reportId = this.reportId;
      this.saveData.customerId = this.customerId;
      this.saveData.planAmount = this.planAmount;
      this.saveData.fapaId  = this.fapaId;
      let p1 = {
        title: this.saveData.wayPicture[0] == undefined ? null : this.saveData.wayPicture[0].name,
        fileUrl: this.saveData.wayPicture[0] == undefined ? null : this.saveData.wayPicture[0].url,
        type: 55141001
      };
      let p2 = {
        title: this.saveData.wayPicture1[0] == undefined ? null : this.saveData.wayPicture1[0].name,
        fileUrl: this.saveData.wayPicture1[0] == undefined ? null : this.saveData.wayPicture1[0].url,

        type: 55141002
      };
      let p3 = {
        title: this.saveData.wayPicture2[0] == undefined ? null : this.saveData.wayPicture2[0].name,
        fileUrl: this.saveData.wayPicture2[0] == undefined ? null : this.saveData.wayPicture2[0].url,
        type: 55141003
      };
      let p4 = {
        title: this.saveData.wayPicture3[0] == undefined ? null : this.saveData.wayPicture3[0].name,
        fileUrl: this.saveData.wayPicture3[0] == undefined ? null : this.saveData.wayPicture3[0],
        type: 55141004
      };
      let p5 = {
        title: this.saveData.wayPicture4[0] == undefined ? null : this.saveData.wayPicture4[0].name,
        fileUrl: this.saveData.wayPicture4[0] == undefined ? null : this.saveData.wayPicture4[0],
        type: 55141005
      };
      let p6 = {
        title: this.saveData.wayPicture5[0] == undefined ? null : this.saveData.wayPicture5[0].name,
        fileUrl: this.saveData.wayPicture5[0] == undefined ? null : this.saveData.wayPicture5[0],
        type: 55141006
      };
      this.fileList.push(p1);
      this.fileList.push(p2);
      this.fileList.push(p3);
      this.fileList.push(p4);
      this.fileList.push(p5);
      this.fileList.push(p6);
      this.$refs.fileTable.$refs.pageTable.list.map(x => {
        this.fileList.push(x);
      });
      this.saveData.fileList = this.fileList;
      this.saveData.applyBy = getUserId();
      this.saveData.applyAt = moment().format('YYYY-MM-DD HH:mm:ss');
      let istable = this.$refs.table3.$refs.pageTable.GET_REQUIRED_ERROR();
      if (istable && this.columnsfujiaxiangmu.find(x => x.dataIndex == 'remarks').editRequired == true) {
        this.number = 1;
      } else {
        this.number = 2;
      }
      let sign = this.feiyongformList.find(x => x.fieldName == 'sumAmount').initialValue;
      if (this.feiyongformList.find(x => x.fieldName == 'priceAmount').initialValue) {
        sign = 1;
      }
      if (this.saveData && this.saveData1 && this.saveData3 && this.saveData4 && sign != 0 && this.number == 2) {
        if (this.saveData.priceAmount != null) {
          this.$confirm('此索赔单已开启一口价，确认提交?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          })
            .then(async () => {
              this.loading = true;
              let res = await editSave(this.saveData);

              if (res.resultCode === 200) {
                this.$emit('save');
                return this.$notify.success({ title: '提示信息', message: res.data || '保存成功!' });
              } else {
                this.loading = false;
              }
            })
            .catch(() => {});
        } else {
          this.loading = true;
          let res = await editSave(this.saveData);

          if (res.resultCode === 200) {
            this.$emit('save');
            return this.$notify.success({ title: '提示信息', message: res.data || '保存成功!' });
          } else {
            this.loading = false;
          }
        }
      } else {
        this.$notify.error({ title: '提示信息', message: '保存失败,请检查维修项目、换上件、附加项目是否存在和必填项!' });
      }
    },
    chuanvalue(data) {
      console.log(data,"救救我aaa");
      this.formList1.find(x => {
          if ('partCode' == x.fieldName) {
            x.initialValue = data.partCode; //主损件返显
          }
           if ('partName' == x.fieldName) {
             x.initialValue = data.partName; //主损件返显
           }
          this.changeFaultSelect();

        });
      },
    async zuofei() {
      this.saveFlag = 6;
      this.formList1.find(x => x.fieldName == 'ifTrailer').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'sysName1').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'sysName2').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'sysName3').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'sysName4').rules[0].required = false;
      this.formList.find(x => x.fieldName == 'roNo').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'cmsClaimType').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'supName').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'partCode').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'ifComm').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'faultCode').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'faultName').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'frCode').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'frName').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'faultAppear').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'faultReason').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'cmsClaimPgm').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'authNo').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'wayPicture').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'wayPicture1').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'wayPicture2').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'wayPicture3').rules[0].required = false;
      // this.formList1.find(x => x.fieldName == 'wayPicture4').rules[0].required = false;
      // this.formList1.find(x => x.fieldName == 'wayPicture5').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'selfNo').rules[0].required = false;
      this.formList1.find(x => x.fieldName == 'batchCode').rules[0].required = false;
      this.$refs.formPanel1.SUBMIT_FORM();
      this.$refs.formPanel2.SUBMIT_FORM();
      this.$refs.formPanel3.SUBMIT_FORM();
      //作废不传备件信息
      // let arr = [];
      // this.$refs.table3.$refs.pageTable.list.map(x => {
      //   arr.push(x);
      // });
      // console.log(arr);
      //
      // let arr1 = [];
      // this.$refs.table2.$refs.pageTable.list.map(x => {
      //   arr1.push(x);
      // });
      // console.log(arr1);
      //
      // let arr2 = [];
      // this.$refs.table1.$refs.pageTable.list.map(x => {
      //   arr2.push(x);
      // });
      // console.log(arr2);
      //
      // let arr3 = [];
      // this.$refs.table.$refs.pageTable.list.map(x => {
      //   arr3.push(x);
      // });
      // console.log(arr3);
      // //维修项目
      // this.saveData.labourList = arr3;
      // //换上件
      // this.saveData.partRList = arr2;
      // //换下件
      // this.saveData.partList = arr1;
      // //附加项目
      // this.saveData.addList = arr;

      this.saveData = Object.assign(this.saveData, this.saveData1);
      this.saveData = Object.assign(this.saveData, this.saveData4);
      this.saveData = Object.assign(this.saveData, this.saveData3);
      //判断是保存还是提交 默认0 提交1
      this.saveData.claimStatus = 55131006;

      //保存前格式化时间类型
      //销售日期
      if (this.saveData.saleDate) {
        this.saveData.saleDate = moment(this.saveData.saleDate).format('YYYY-MM-DD HH:mm:ss');
      }
      //保修起始日期
      if (this.saveData.repairBeginDate) {
        this.saveData.repairBeginDate = moment(this.saveData.repairBeginDate).format('YYYY-MM-DD HH:mm:ss');
      }
      //维修开始时间
      if (this.saveData.serviceBeginDate) {
        this.saveData.serviceBeginDate = moment(this.saveData.serviceBeginDate).format('YYYY-MM-DD HH:mm:ss');
      }
      //维修结束时间
      if (this.saveData.serviceEndDate) {
        this.saveData.serviceEndDate = moment(this.saveData.serviceEndDate).format('YYYY-MM-DD HH:mm:ss');
      }
      //自费备件销售日期
      // this.saveData.selfSdate = moment(this.saveData.selfSdate).format('YYYY-MM-DD HH:mm:ss');
      //生产日期
      if (this.saveData.prodDate) {
        this.saveData.prodDate = moment(this.saveData.prodDate).format('YYYY-MM-DD HH:mm:ss');
      }
      this.saveData.claimId = this.rowData.claimId;
      this.saveData.partId = this.partId;
      this.saveData.supId = this.supId;
      this.saveData.supCode = this.supCode;
      this.saveData.modelId = this.modelId;
      this.saveData.modelCode = this.modelCode;
      this.saveData.faId = this.faId; //故障现象主键
      this.saveData.frId = this.frId; //故障原因主键
      this.saveData.outId = this.outId;
      this.saveData.isDeleted = this.isDeleted;
      this.saveData.outCode = this.outCode;
      this.saveData.claimNo = this.claimNo;
      this.saveData.appId = this.rowData.appId;
      this.saveData.createdAt = this.rowData.createdAt;
      this.saveData.createdBy = this.rowData.createdBy;
      this.saveData.recordVersion = this.rowData.recordVersion;
      this.saveData.ownerCode = this.rowData.ownerCode;
      this.saveData.ownerParCode = this.rowData.ownerParCode;
      this.saveData.submitAt = this.rowData.submitAt;
      this.saveData.orgId = this.rowData.orgId;
      this.saveData.applyBy = getUserId();
      this.saveData.applyAt = moment().format('YYYY-MM-DD HH:mm:ss');
      this.saveData.reportId = this.reportId;
      this.saveData.customerId = this.customerId;
      this.saveData.planAmount = this.planAmount;
      let p1 = {
        title: this.saveData.wayPicture[0] == undefined ? null : this.saveData.wayPicture[0].name,
        fileUrl: this.saveData.wayPicture[0] == undefined ? null : this.saveData.wayPicture[0],
        type: 55141001
      };
      let p2 = {
        title: this.saveData.wayPicture1[0] == undefined ? null : this.saveData.wayPicture1[0].name,
        fileUrl: this.saveData.wayPicture1[0] == undefined ? null : this.saveData.wayPicture1[0],
        type: 55141002
      };
      let p3 = {
        title: this.saveData.wayPicture2[0] == undefined ? null : this.saveData.wayPicture2[0].name,
        fileUrl: this.saveData.wayPicture2[0] == undefined ? null : this.saveData.wayPicture2[0],
        type: 55141003
      };
      let p4 = {
        title: this.saveData.wayPicture3[0] == undefined ? null : this.saveData.wayPicture3[0].name,
        fileUrl: this.saveData.wayPicture3[0] == undefined ? null : this.saveData.wayPicture3[0],
        type: 55141004
      };
      let p5 = {
        title: this.saveData.wayPicture4[0] == undefined ? null : this.saveData.wayPicture4[0].name,
        fileUrl: this.saveData.wayPicture4[0] == undefined ? null : this.saveData.wayPicture4[0],
        type: 55141005
      };
      let p6 = {
        title: this.saveData.wayPicture5[0] == undefined ? null : this.saveData.wayPicture5[0].name,
        fileUrl: this.saveData.wayPicture5[0] == undefined ? null : this.saveData.wayPicture5[0],
        type: 55141006
      };
      this.fileList.push(p1);
      this.fileList.push(p2);
      this.fileList.push(p3);
      this.fileList.push(p4);
      this.fileList.push(p5);
      this.fileList.push(p6);
      this.saveData.fileList = this.fileList;
      this.saveData.applyBy = getUserId();
      this.saveData.applyAt = moment().format('YYYY-MM-DD HH:mm:ss');
      this.saveData.isDeleted = 1;
      if (this.saveData && this.saveData1 && this.saveData3 && this.saveData4) {
        this.loading = true;
        let res = await editSave(this.saveData);

        if (res.resultCode === 200) {
          this.$emit('save');
          return this.$notify.success({ title: '提示信息', message: '保存成功' });
        } else {
          this.loading = false;
        }
      } else {
        this.$notify.error({ title: '提示信息', message: '保存失败,请检查数据格式和必填项!' });
      }
    },
    async changeFaultSelect() {
      if(getAppId()=='beijing'){
         console.log("一点");
         let partCode = await getListByPage({appId: getAppId(),faStatus:1,isDeleted:0,partCode: this.formList1.find(x => x.fieldName == 'partCode').initialValue,current:1,currentPage:1,limit:20,pageNum:1,pageSize:20,size:20});
         console.log(partCode.data.records,"两点");
         if (partCode.data.records.length <= 0) {
            this.formList1.find(x => x.fieldName == 'sysCode1').initialValue = '';
            this.formList1.find(x => x.fieldName == 'sysName1').initialValue = '';
            this.formList1.find(x => x.fieldName == 'sysCode2').initialValue = '';
            this.formList1.find(x => x.fieldName == 'sysName2').initialValue = '';
            this.formList1.find(x => x.fieldName == 'sysCode3').initialValue = '';
            this.formList1.find(x => x.fieldName == 'sysName3').initialValue = '';
            this.formList1.find(x => x.fieldName == 'sysCode4').initialValue = '';
            this.formList1.find(x => x.fieldName == 'sysName4').initialValue = '';
            this.formList1.find(x => x.fieldName == 'faultCode').initialValue = '';
            this.formList1.find(x => x.fieldName == 'faultName').initialValue = '';
         }else{
            this.formList1.find(x => x.fieldName == 'sysCode1').initialValue = partCode.data.records[0].sysCode1;
            this.formList1.find(x => x.fieldName == 'sysName1').initialValue = partCode.data.records[0].sysName1;
            this.formList1.find(x => x.fieldName == 'sysCode2').initialValue = partCode.data.records[0].sysCode2;
            this.formList1.find(x => x.fieldName == 'sysName2').initialValue = partCode.data.records[0].sysName2;
            this.formList1.find(x => x.fieldName == 'sysCode3').initialValue = partCode.data.records[0].sysCode3;
            this.formList1.find(x => x.fieldName == 'sysName3').initialValue = partCode.data.records[0].sysName3;
            this.formList1.find(x => x.fieldName == 'sysCode4').initialValue = partCode.data.records[0].sysCode4;
            this.formList1.find(x => x.fieldName == 'sysName4').initialValue = partCode.data.records[0].sysName4;
            this.formList1.find(x => x.fieldName == 'faultCode').initialValue = partCode.data.records[0].faultCode;
            this.formList1.find(x => x.fieldName == 'faultName').initialValue = partCode.data.records[0].faultName;
            this.faId = partCode.data.records[0].faultId;
         }
      }
    },

    async changeSysName1Select(sysCode1) {
      console.log(sysCode1,"sysCode1sysCode1sysCode1");
      this.formList1.find(item=>item.fieldName==='sysName2').initialValue = '';
      this.formList1.find(item=>item.fieldName==='sysCode2').initialValue = '';
      this.formList1.find(item=>item.fieldName==='sysName2').itemList = [];
      this.formList1.find(item=>item.fieldName==='sysName3').initialValue = '';
      this.formList1.find(item=>item.fieldName==='sysCode3').initialValue = '';
      this.formList1.find(item=>item.fieldName==='sysName3').itemList = [];
      this.formList1.find(item=>item.fieldName==='sysName4').initialValue = '';
      this.formList1.find(item=>item.fieldName==='sysCode4').initialValue = '';
      this.formList1.find(item=>item.fieldName==='sysName4').itemList = [];
      if (sysCode1) {
        const res = await getSysName2List(sysCode1);
        if (res.resultCode === 200) {
          console.log(res,"resresresresresresresresresresresresresresres");
          console.log(res.data,"res.datares.datares.datares.datares.datares.datares.data");
          this.formList1.find(item=>item.fieldName==='sysName2').itemList = res.data.map(x => ({ text: x.sysName2,value:x.sysCode2 }));
        }
      }
    },

    async changeSysName2Select(sysCode2) {
      const sysCode1 = this.formList1.find(item=>item.fieldName==='sysCode1').initialValue;
      console.log(sysCode1,"sysCode1sysCode1sysCode1sysCode1sysCode1sysCode1sysCode1sysCode1sysCode1");
      if (sysCode1 && sysCode2) {
        this.formList1.find(item=>item.fieldName==='sysName3').initialValue = '';
        this.formList1.find(item=>item.fieldName==='sysCode3').initialValue = '';
        this.formList1.find(item=>item.fieldName==='sysName3').itemList = [];
        this.formList1.find(item=>item.fieldName==='sysName4').initialValue = '';
        this.formList1.find(item=>item.fieldName==='sysCode4').initialValue = '';
        this.formList1.find(item=>item.fieldName==='sysName4').itemList = [];
        const res = await getSysName3List(sysCode1,sysCode2);
        if (res.resultCode === 200) {
          console.log(res,"resresresresresresresresresresresresresresres");
          console.log(res.data,"res.datares.datares.datares.datares.datares.datares.data");
        this.formList1.find(item=>item.fieldName==='sysName3').itemList = res.data.map(x => ({ text: x.sysName3,value:x.sysCode3 }));
        }
      }
    },
    async changeSysName3Select(sysCode3) {
      const sysCode1 = this.formList1.find(item=>item.fieldName==='sysCode1').initialValue;
      const sysCode2 = this.formList1.find(item=>item.fieldName==='sysCode2').initialValue;
      console.log(sysCode3,"sysCode3sysCode3sysCode3sysCode3sysCode3");
      if (sysCode1 && sysCode2 &&sysCode3) {
        this.formList1.find(item=>item.fieldName==='sysName4').initialValue = '';
        this.formList1.find(item=>item.fieldName==='sysCode4').initialValue = '';
        this.formList1.find(item=>item.fieldName==='sysName4').itemList = [];
        const res = await getSysName4List(sysCode1,sysCode2,sysCode3);
        if (res.resultCode === 200) {
          console.log(res,"mmmmmmmm");
          console.log(res.data,"sysName4sysName4sysName4sysName4sysName4");
        this.formList1.find(item=>item.fieldName==='sysName4').itemList = res.data.map(x => ({ text: x.sysName4,value:x.sysCode4 }));
        }
      }

    },

    async getFaultNameSelect(sysCode4){
      const sysCode1 = this.formList1.find(item=>item.fieldName==='sysCode1').initialValue;
      const sysCode2 = this.formList1.find(item=>item.fieldName==='sysCode2').initialValue;
      const sysCode3 = this.formList1.find(item=>item.fieldName==='sysCode3').initialValue;
      if (sysCode1 && sysCode2 &&sysCode3 && sysCode4) {
      const res = await getFaultName(sysCode1,sysCode2,sysCode3,sysCode4);
      if (res.resultCode === 200) {
          console.log(res,"lllllllluuuu");
          console.log(res.data,"FaultNameFaultNameFaultNameFaultName");
          this.formList1.find(x => x.fieldName == 'faultName').initialValue = res.data[0].faultName;
          this.formList1.find(x => x.fieldName == 'faultCode').initialValue = res.data[0].faultCode;
          this.faId = res.data[0].faultId;
          console.log(res,"成功了嘛");
        }
      }
    },
    createFormList() {
      return [
        {
          type: 'INPUT',
          label: '索赔单号',
          fieldName: 'claimNo',
          placeholder: '请输入标题名称...',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '维修工单号',
          fieldName: 'roNo',
          placeholder: '请输入维修工单号...',
          rules: [{ required: true, message: '请输入维修工单号', trigger: 'blur' }],
          readonly: true,
          disabled: true,
          unitRender: p => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectRono()} />
              </div>
            );
          }
        },
        {
          type: 'SELECT',
          label: '索赔单状态',
          fieldName: 'claimStatus',
          disabled: true, // 只读
          itemList: this.createDictList('5513')
        },
        {
          type: 'INPUT',
          label: '车牌号',
          fieldName: 'licenseNo',
          placeholder: '请输入标题名称...',
          disabled: true,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '电机号',
          fieldName: 'butteryEngineNo',
          disabled: true,
          placeholder: '请输入电机号...'
        },
        {
          type: 'INPUT',
          label: '发动机号',
          fieldName: 'engineNo',
          disabled: true,
          placeholder: '请输入发动机号...'
        },
        {
          type: 'INPUT',
          label: '变速箱号',
          fieldName: 'gearbox',
          disabled: true,
          placeholder: '请输入变速箱号...'
        },
        {
          type: 'INPUT',
          label: '营运类型',
          fieldName: 'useType',
          disabled: true,
          itemList: this.createDictList('1511')
        },
        {
          type: 'INPUT',
          label: '车系名称',
          fieldName: 'seriesName',
          placeholder: '请输入车系名称...',
          disabled: true,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '车型名称',
          fieldName: 'modelName',
          placeholder: '请输入标题名称...',
          disabled: true,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '销售日期',
          fieldName: 'saleDate',
          placeholder: '请输入标题名称...',
          hidden:true,
          readonly: true, // 只读
          disabled: true
        },
        {
          type: 'INPUT',
          label: '保修起始日期',
          fieldName: 'repairBeginDate',
          placeholder: '请输入标题名称...',
          readonly: true, // 只读
          disabled: true
        },
        {
          type: 'INPUT',
          label: '保修结束日期',
          fieldName: 'repairEndDate',
          placeholder: '请输入标题名称...',
          readonly: true, // 只读
          disabled: true
        },
        {
          type: 'DATE',
          label: '维修开始时间',
          fieldName: 'serviceBeginDate',
          placeholder: '请输入标题名称...',
          // valueFormat:'yyyy-MM-DD HH:mm:ss',
          hidden:true,
          readonly: true, // 只读
          disabled: true
        },
        {
          type: 'DATE',
          label: '维修结束时间',
          fieldName: 'serviceEndDate',
          placeholder: '请输入标题名称...',
          // valueFormat:'yyyy-MM-DD HH:mm:ss',
          hidden:true,
          readonly: true, // 只读
          disabled: true
        },
        {
          type: 'INPUT',
          label: '生产日期',
          fieldName: 'prodDate',
          placeholder: '请输入标题名称...',
          hidden:true,
          readonly: true, // 只读
          disabled: true
        },

        {
          type: 'INPUT',
          label: '车主姓名',
          fieldName: 'customerName',
          placeholder: '请输入标题名称...',
          disabled: true,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '车主手机号',
          fieldName: 'customerPhone',
          placeholder: '请输入标题名称...',
          disabled: true,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '送修人姓名',
          fieldName: 'serviceName',
          placeholder: '请输入标题名称...',
          readonly: true, // 只读
          disabled: true
        },
        {
          type: 'INPUT',
          label: '送修人手机号',
          fieldName: 'servicePhone',
          placeholder: '请输入标题名称...',
          readonly: true, // 只读
          disabled: true
        },
        {
          type: 'INPUT',
          label: '购件里程',
          fieldName: 'partMile',
          placeholder: '请输入标题名称...',
          disabled: true,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '购件日期',
          fieldName: 'partDate',
          placeholder: '请输入标题名称...',
          disabled: true,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '累计行驶里程',
          fieldName: 'driveMile',
          placeholder: '请输入标题名称...',
          disabled: true,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '仪表里程',
          fieldName: 'meterMile',
          placeholder: '请输入标题名称...',
          disabled: true,
          readonly: true // 只读
        },
        {
          type: 'SELECT',
          label: '是否更换电池',
          fieldName: 'isChangeBattery',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1004')
        },
        {
          type: 'INPUT',
          label: '电池编号',
          fieldName: 'batteryNo',
          rules: [{ required: false, message: '请输入电池编号...', trigger: 'blur' }],
          placeholder: '请输入电池编号...'
        },
        {
          type: 'INPUT',
          label: '新电池编号',
          fieldName: 'newBatteryNo',
          rules: [{ required: false, message: '请输入电池编号...', trigger: 'blur' }],
          placeholder: '请输入电池编号...'
        },
        {
          type: 'INPUT',
          label: '提报人',
          fieldName: 'applyName',
          placeholder: '所属分类',
          hidden:true,
          disabled: true // 禁用
        },
        {
          type: 'INPUT',
          label: '联系方式',
          fieldName: 'applyPhone',
          placeholder: '选择日期',
          hidden:true,
          readonly: true,
          disabled: true
        },
        {
          type: 'SELECT',
          label: '用户属性',
          fieldName: 'customerType',
          hidden:true,
          readonly: true,
          disabled: true,
          itemList: this.createDictList('5584')
        },
        {
          type: 'SELECT',
          label: '是否特殊车辆',
          fieldName: 'isSpecial',
          hidden:true,
          readonly: true,
          disabled: true,
          itemList: this.createDictList('5532')
        }
      ];
    },

    formList1Fn() {
      return [
        {
          type: 'SELECT',
          label: '索赔类型',
          fieldName: 'cmsClaimType',
          placeholder: '请选择',
          initialValue: '',
          itemList: [],
          rules: [{ required: true, message: '请选择索赔类型', trigger: 'change' }],
          change: async val => {
            this.addFlag =false;
            if (val == 55011011) {
              this.typeForAC();
              if(this.formList1.find(x => x.fieldName == 'ifComm').initialValue == 55431001) {
                this.flag = false;
              }else{
                this.flag = true;
              }
              this.columnshuanxiajian.find(x => x.dataIndex == 'partCount').editable = false;
              this.columns1.find(x => x.dataIndex == 'partCount').editable = false;
              this.selfCode(val);
            } else {
              this.flag = false;
              if (val == 55011004) {
                this.formList1.map(y => {
                  if (y.fieldName == 'selfNo') {
                    y.hidden = false;
                  }
                  if (y.fieldName == 'selfSdate') {
                    y.hidden = false;
                  }
                  if (y.fieldName == 'selfUseMile') {
                    y.hidden = false;
                  }
                  if (y.fieldName == 'selfUseHours') {
                    y.hidden = false;
                  }
                  if (y.fieldName == 'selfMile') {
                    y.hidden = false;
                  }
                  if (y.fieldName == 'cmsClaimType') {
                    y.initialValue = val;
                  }
                  if (y.fieldName == 'authNo') {
                    y.rules[0].required = false;
                  }
                  if (y.fieldName == 'batchCode') {
                    y.disabled = true;
                    y.rules[0].required = false;
                  }
                });
                this.feiyongformList.find(x => x.fieldName == 'priceAmount').initialValue = null;
              } else if (val == 55011003 || val == 55011010 || val == 55011005) {
                this.formList1.map(y => {
                  if (y.fieldName == 'selfNo') {
                    y.hidden = true;
                    y.initialValue = undefined;
                  }
                  if (y.fieldName == 'selfSdate') {
                    y.hidden = true;
                    y.initialValue = undefined;
                  }
                  if (y.fieldName == 'selfUseMile') {
                    y.hidden = true;
                    y.initialValue = undefined;
                  }
                  if (y.fieldName == 'selfUseHours') {
                    y.hidden = true;
                    y.initialValue = undefined;
                  }
                  if (y.fieldName == 'selfMile') {
                    y.hidden = true;
                    y.initialValue = undefined;
                  }
                  if (y.fieldName == 'cmsClaimType') {
                    y.initialValue = val;
                  }
                  if (y.fieldName == 'authNo') {
                    y.rules[0].required = true;
                  }
                  if (y.fieldName == 'batchCode') {
                    y.disabled = true;
                    y.rules[0].required = false;
                    y.initialValue = '';
                  }
                  if (y.fieldName == 'batchName') {
                    y.initialValue = '';
                  }
                });
                this.feiyongformList.find(x => x.fieldName == 'priceAmount').initialValue = null;
                if ( val == 55011010) {
                  this.addFlag =true;
                }
              } else if (val == 55011009) {
                this.formList1.map(y => {
                  if (y.fieldName == 'selfNo') {
                    y.hidden = true;
                    y.initialValue = undefined;
                  }
                  if (y.fieldName == 'selfSdate') {
                    y.hidden = true;
                    y.initialValue = undefined;
                  }
                  if (y.fieldName == 'selfUseMile') {
                    y.hidden = true;
                    y.initialValue = undefined;
                  }
                  if (y.fieldName == 'selfUseHours') {
                    y.hidden = true;
                    y.initialValue = undefined;
                  }
                  if (y.fieldName == 'selfMile') {
                    y.hidden = true;
                    y.initialValue = undefined;
                  }
                  if (y.fieldName == 'cmsClaimType') {
                    y.initialValue = val;
                  }
                  if (y.fieldName == 'authNo') {
                    y.rules[0].required = false;
                  }
                  if (y.fieldName == 'batchCode') {
                    y.disabled = false;
                    y.rules[0].required = true;
                    y.initialValue = '';
                  }
                  if (y.fieldName == 'batchName') {
                    y.initialValue = '';
                  }
                });
                this.feiyongformList.find(x => x.fieldName == 'priceAmount').initialValue = null;
              } else if (val == 55011006) {
                await this.typeForSB();
                this.selfCode(val);
              } else if (val == 55011007) {
                await this.typeForPDI();
                this.selfCode(val);
              } else {
                this.selfCode(val);
                this.feiyongformList.find(x => x.fieldName == 'priceAmount').initialValue = null;
              }
              await this.typeForBJ();
              this.columnshuanxiajian.find(x => x.dataIndex == 'partCount').editable = false;
              // this.columns1.find(x=>x.dataIndex=='partCount').editable=true;
            }
          }
        },
        // { type: 'SELECT', label: '是否拖车', fieldName: 'ifTrailer', placeholder: '请选择', initialValue: '', itemList: [{text: '是', value: 1}, {text: '否', value: 0}],rules: [{required: true, message: '请选择是否拖车...', trigger: 'change'}]},
        {
          type: 'INPUT',
          label: '预授权单号',
          fieldName: 'authNo',
          readonly: true,
          rules: [{ required: false, message: '请输入预授权单号', trigger: 'change' }],
          placeholder: '请输入...',
          unitRender: p => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectYsqCode()} />
              </div>
            );
          }
        },
        {
          type: 'INPUT',
          label: '批量活动编号',
          fieldName: 'batchCode',
          placeholder: '请输入批量活动编号...',
          readonly: true,
          disabled: true,
          rules: [{ required: false, message: '请输入批量活动编号', trigger: 'blur' }],
          unitRender: p => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.batchActivitiesShow()} />
              </div>
            );
          }
        },
        {
          type: 'INPUT',
          label: '批量活动名称',
          fieldName: 'batchName',
          placeholder: '请输入批量活动名称...',
          disabled: true
        },
        // {
        //   type: 'INPUT',
        //   label: '主损件',
        //   fieldName: 'partCode',
        //   placeholder: '请输入...',
        //   readonly: true,
        //   rules: [{ required: true, message: '请输入主损件', trigger: 'blur' }],
        //   unitRender: p => {
        //     return (
        //       <div>
        //         <multiuse-button icon="el-icon-search" onClick={() => this.selectpartCode()} />
        //       </div>
        //     );
        //   }
        // },
        // {
        //   type: 'INPUT',
        //   label: '主损件名称',
        //   fieldName: 'partName',
        //   placeholder: '请输入...',
        //   disabled: true
        // },
        // {
        //   type: 'INPUT',
        //   label: '供应商',
        //   fieldName: 'supName',
        //   placeholder: '请选择',
        //   readonly: true,
        //   rules: [{ required: true, message: '请输入供应商', trigger: 'blur' }],
        //   unitRender: p => {
        //     return (
        //       <div>
        //         <multiuse-button icon="el-icon-search" onClick={() => this.selectSuppliersCode()} />
        //       </div>
        //     );
        //   }
        // },
        // {
        //   type: 'SELECT',
        //   label: '车辆属性',
        //   fieldName: 'ifComm',
        //   placeholder: '请选择',
        //   initialValue: '',
        //   itemList: this.createDictList('5543'),
        //   disabled: true,
        //   rules: [{ required: true, message: '请选择车辆属性', trigger: 'blur' }]
        // },
        {
          type: 'INPUT',
          label: '故障现象',
          fieldName: 'sysName4',
          readonly: true,
          placeholder: '请选择故障现象...',
          rules: [{ required: true, message: '请选择故障现象...', trigger: 'blur' }],
          unitRender: p => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectfaultCode()} />
              </div>
            );
          }
        },
        {
          type: 'INPUT',
          label: '故障原因',
          fieldName: 'frName',
          readonly: true,
          placeholder: '请选择故障原因...',
          rules: [{ required: true, message: '请选择故障原因...', trigger: 'blur' }],
          unitRender: p => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectfaultReason()} />
              </div>
            );
          }
        },
        // {
        //   type: 'INPUT',
        //   label: '故障现象代码',
        //   fieldName: 'faultCode',
        //   rules: [{ required: true, message: '请选择故障现象代码', trigger: 'blur' }],
        //   readonly: true,
        //   unitRender: p => {
        //     return (
        //       <div>
        //         <multiuse-button icon="el-icon-search" onClick={() => this.selectfaultCode()} />
        //       </div>
        //     );
        //   }
        // },
        // {
        //   type: 'INPUT',
        //   label: '故障现象描述',
        //   fieldName: 'faultName',
        //   placeholder: '请输入...',
        //   initialValue: undefined,
        //   disabled: true,
        //   rules: [{ required: true, message: '请输入故障现象描述', trigger: 'blur' }]
        // },
        // {
        //   type: 'INPUT',
        //   label: '一级代码',
        //   fieldName: 'sysCode1',
        //   placeholder: '请输入...',
        //   disabled: true
        // },
        // {
        //   type: 'SELECT',
        //   label: '一级名称',
        //   fieldName: 'sysName1',
        //   placeholder: '请选择...',
        //   disabled: false,
        //   itemList: [],
        //   rules: [{required: true, message: '请选择一级名称...', trigger: 'change'}],
        //   change: val => {
        //       this.changeSysName1Select(val);
        //       let sysName1 = this.formList1.find(x => x.fieldName == 'sysCode1').initialValue
        //       let list = this.formList1.find(x => x.fieldName === 'sysName1').itemList;
        //       console.log(list,"listlistlist");
        //       console.log(val,"valvalvalval");
        //       this.formList1.find(x => x.fieldName == 'sysCode1').initialValue =list.find(x => x.value === val).value;
        //   }
        // },
        // {
        //   type: 'INPUT',
        //   label: '二级代码',
        //   fieldName: 'sysCode2',
        //   placeholder: '请输入...',
        //   disabled: true
        // },
        // {
        //   type: 'SELECT',
        //   label: '二级名称',
        //   fieldName: 'sysName2',
        //   placeholder: '请选择...',
        //   disabled: false,
        //   itemList: [],
        //   rules: [{required: true, message: '请选择二级名称...', trigger: 'change'}],
        //   change: val => {
        //       let list1 = this.formList1.find(x => x.fieldName === 'sysName2').itemList;
        //       this.formList1.find(x => x.fieldName == 'sysCode2').initialValue =list1.find(x => x.value === val).value;
        //       this.changeSysName2Select(val);
        //   }
        //
        // },
        // {
        //   type: 'INPUT',
        //   label: '三级代码',
        //   fieldName: 'sysCode3',
        //   placeholder: '请输入...',
        //   disabled: true
        // },
        // {
        //   type: 'SELECT',
        //   label: '三级名称',
        //   fieldName: 'sysName3',
        //   placeholder: '请输入...',
        //   disabled: false,
        //   itemList: [],
        //   rules: [{required: true, message: '请选择三级名称...', trigger: 'change'}],
        //   change: val => {
        //       let list2 = this.formList1.find(x => x.fieldName === 'sysName3').itemList;
        //       this.formList1.find(x => x.fieldName == 'sysCode3').initialValue =list2.find(x => x.value === val).value;
        //       this.changeSysName3Select(val);
        //   }
        // },
        // {
        //   type: 'INPUT',
        //   label: '故障代码',
        //   fieldName: 'sysCode4',
        //   placeholder: '请输入...',
        //   disabled: true
        // },
        // {
        //   type: 'SELECT',
        //   label: '故障描述',
        //   fieldName: 'sysName4',
        //   placeholder: '请输入...',
        //   disabled: false,
        //   itemList: [],
        //   rules: [{required: true, message: '请选择故障描述...', trigger: 'change'}],
        //   change: val => {
        //       let list3 = this.formList1.find(x => x.fieldName === 'sysName4').itemList;
        //       this.formList1.find(x => x.fieldName == 'sysCode4').initialValue =list3.find(x => x.value === val).value;
        //       this.getFaultNameSelect(val);
        //   }
        // },
        // {
        //   type: 'INPUT',
        //   label: '分类',
        //   fieldName: 'frCode',
        //   readonly: true,
        //   rules: [{ required: true, message: '请选择分类', trigger: 'blur' }],
        //   unitRender: p => {
        //     return (
        //       <div>
        //         <multiuse-button icon="el-icon-search" onClick={() => this.selectfaultReason()} />
        //       </div>
        //     );
        //   }
        // },
        // {
        //   type: 'INPUT',
        //   label: '故障原因描述',
        //   fieldName: 'frName',
        //   placeholder: '请输入故障原因描述...',
        //   initialValue: undefined,
        //   disabled: true,
        //   rules: [{ required: true, message: '请输入故障原因描述', trigger: 'blur' }]
        // },
        // {
        //   type: 'INPUT',
        //   label: '质量报告单号',
        //   fieldName: 'reportNo',
        //   placeholder: '请输入质量报告单号...',
        //   initialValue: undefined,
        //   readonly: true,
        //   unitRender: p => {
        //     return (
        //       <div>
        //         <multiuse-button icon="el-icon-search" onClick={() => this.selectReportNo()} />
        //       </div>
        //     );
        //   }
        // },
        {
          type: 'INPUT',
          label: '救援单号',
          fieldName: 'outNo',
          placeholder: '请输入救援单号...',
          initialValue: undefined,
          readonly: true,
          unitRender: p => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectOutNo()} />
                <multiuse-button type="primary" icon="el-icon-document" onClick={() => this.detail()}/>
              </div>
            );
          }
        },
        {
          type: 'INPUT',
          label: '自费工单号',
          fieldName: 'selfNo',
          placeholder: '请输入自费工单号...',
          readonly: true,
          hidden: true,
          rules: [{ required: true, message: '请输入自费工单号', trigger: 'change' }],
          unitRender: p => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectselfNo()} />
              </div>
            );
          }
        },
        {
          type: 'INPUT',
          label: '自费备件销售日期',
          fieldName: 'selfSdate',
          placeholder: '请输入...',
          initialValue: undefined,
          hidden: true,
          disabled: true
          // rules: [{ required: true, message: '请输入自费备件销售日期', trigger: 'change' }],
        },
        {
          type: 'INPUT',
          label: '自费备件使用里程',
          fieldName: 'selfUseMile',
          placeholder: '请输入...',
          initialValue: undefined,
          hidden: true,
          disabled: true
          // rules: [{ required: true, message: '请输入维修方案', trigger: 'change' }],
        },
        {
          type: 'INPUT',
          label: '自费备件使用时长',
          fieldName: 'selfUseHours',
          placeholder: '请输入...',
          initialValue: undefined,
          hidden: true,
          disabled: true
          // rules: [{ required: true, message: '请输入自费备件使用时长', trigger: 'change' }],
        },
        {
          type: 'INPUT',
          label: '自费备件销售里程',
          fieldName: 'selfMile',
          placeholder: '请输入...',
          initialValue: undefined,
          hidden: true,
          disabled: true
          // rules: [{ required: true, message: '请输入自费备件使用里程', trigger: 'change' }],
        },
        {
          type: 'TEXT_AREA',
          label: '故障现象',
          fieldName: 'faultAppear',
          placeholder: '故障现象',
          rules: [{ required: true, message: '请输入故障现象', trigger: 'change' }],
          rows: 3,
          selfCols: 4 // 元素占据几行
        },
        {
          type: 'TEXT_AREA',
          label: '故障原因',
          fieldName: 'faultReason',
          placeholder: '故障原因',
          rules: [{ required: true, message: '请输入故障原因', trigger: 'change' }],
          rows: 3,
          selfCols: 4 // 元素占据几行
        },
        {
          type: 'TEXT_AREA',
          label: '维修方案',
          fieldName: 'cmsClaimPgm',
          placeholder: '维修方案',
          rules: [{ required: true, message: '请输入维修方案', trigger: 'change' }],
          rows: 3,
          selfCols: 4 // 元素占据几行
        },
        {
          type: 'TEXT_AREA',
          label: '备注',
          fieldName: 'remark',
          placeholder: '备注',
          rules: [{ required: false, message: '请选择备注', trigger: 'change' }],
          rows: 3,
          selfCols: 4 // 元素占据几行
        },
        {
          type: 'BREAK_SPACE',
          label: '附件'
        },
        {
          type: 'UPLOAD_IMG',
          label: 'VIN',
          fieldName: 'wayPicture',
          placeholder: '上传VIN...',
          selfCols: 1,
          initialValue: [],
          rules: [{ required: false, message: '请上传VIN', trigger: 'change' }],
          upload: {
            actionUrl: config.uploadUrl+'/api/file/oss/upload',
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true
          }
        },
        {
          type: 'UPLOAD_IMG',
          label: '里程（仪表）',
          fieldName: 'wayPicture1',
          placeholder: '上传身份证...',
          selfCols: 1,
          initialValue: [],
          rules: [{ required: false, message: '请上传里程（仪表）', trigger: 'change' }],
          upload: {
            actionUrl: config.uploadUrl+'/api/file/oss/upload',
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true
          }
        },
        {
          type: 'UPLOAD_IMG',
          label: '车牌（车头）',
          fieldName: 'wayPicture2',
          placeholder: '上传车牌（车头）...',
          offsetRightCols: 1,
          initialValue: [],
          rules: [{ required: false, message: '请上传车牌（车头）', trigger: 'change' }],
          upload: {
            actionUrl: config.uploadUrl+'/api/file/oss/upload',
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true
          }
        },
        {
          type: 'UPLOAD_IMG',
          label: '行驶证',
          fieldName: 'wayPicture3',
          placeholder: '上传行驶证...',
          selfCols: 1,
          initialValue: [],
          rules: [{ required: false, message: '请上传行驶证', trigger: 'change' }],
          upload: {
            actionUrl: config.uploadUrl+'/api/file/oss/upload',
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true
          }
        },
        {
          type: 'UPLOAD_IMG',
          label: '故障照片',
          fieldName: 'wayPicture4',
          placeholder: '上传故障照片...',
          initialValue: [],
          selfCols: 1,
          // rules: [{ required: true, message: '请上传故障照片', trigger: 'change' }],
          upload: {
            actionUrl: config.uploadUrl+'/api/file/oss/upload',
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true
          }
        },
        {
          type: 'UPLOAD_IMG',
          label: '故障照片',
          fieldName: 'wayPicture5',
          placeholder: '上传故障照片...',
          selfCols: 1,
          initialValue: [],
          // rules: [{ required: true, message: '请上传故障照片', trigger: 'change' }],
          upload: {
            actionUrl: config.uploadUrl+'/api/file/oss/upload',
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true
          }
        }
      ];
    },
    createdTable() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          fixed: 'left',
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '操作',
          dataIndex: 'column-action',
          width: 90,
          render: (props, h) => {
            return (
              <div>
                <el-button size="mini" type="text" onClick={() => this.delVideo(props.row)}>
                  删除
                </el-button>
              </div>
            );
          }
        },
        {
          title: '附件标题',
          dataIndex: 'title',
          showOverflowTooltip: true,
          render: p => {
            return (
              <a style="color:#bb0a30" href={p.row.fileUrl} target="_blank" download={p.row.title}>
                {p.row.title}
              </a>
            );
          }
        },
        {
          title: '上传日期',
          dataIndex: 'createdAt'
        }
      ];
    },
    //维修项目
    creatHeader() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          fixed: 'left',
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '操作',
          dataIndex: 'column-action',
          width: 80,
          render: props => {
            return (
              <div style="text-align:center">
                <multiuse-button type="text" disabled={this.flag} onClick={() => this.delsFun(props.row)}>
                  删除
                </multiuse-button>
              </div>
            );
          }
        },
        {
          title: '主工位',
          dataIndex: 'ifMain',
          sorter: true,
          editType: 'checkbox',
          editItems: [
            { text: '', trueValue: 10041001 },
            { text: '', falseValue: 10041002 }
          ]
        },
        { title: '是否特批', dataIndex: 'isSpecial', sorter: true },
        { title: '维修项目代码', dataIndex: 'labourCode', sorter: true },
        { title: '维修项目名称', dataIndex: 'labourName', sorter: true },
        { title: '维修类型', dataIndex: 'cmsClaimType', sorter: true, dictItems: [] },
        { title: '标准工时', dataIndex: 'labourHours', sorter: true },
        { title: '索赔工时单价', dataIndex: 'cmsClaimPrice', sorter: true },
        { title: '索赔金额', dataIndex: 'cmsClaimAmount', sorter: true }
      ];
    },
    //table表头和数据源
    creatHeader1() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          fixed: 'left',
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '操作',
          dataIndex: 'column-action',
          width: 80,
          render: props => {
            return (
              <div style="text-align:center">
                <multiuse-button type="text" disabled={this.flag} onClick={() => this.delsFunSj(props.row)}>
                  删除
                </multiuse-button>
              </div>
            );
          }
        },
        { title: '备件代码', dataIndex: 'partCode', sorter: true },
        { title: '备件名称', dataIndex: 'partName', sorter: true },
        { title: '单位', dataIndex: 'partUnit', sorter: true },
        // { title: '剩余数量', dataIndex: 'lessCount', sorter: true },
        {
          title: '数量',
          dataIndex: 'partCount',
          // editable: false,
          editType: 'number'
          // editRequired: true,
          //   editValidator:(val, row, callback) => {
          //     this.$refs.table2.$refs.pageTable.list.map((x) => {
          //       if (row.partCode == x.partCode) {
          //         this.number = x.partCount
          //       }
          //     });
          //     if(row.partCount>=0){
          //       if(row.partCount<this.number){
          //         this.$notify.error({ title: '提示信息', message: '已小于换下件数量(' + this.number + ')' || '操作失败!' });
          //         row.partCount = this.number;
          //       }else if(row.partCount>row.lessCount){
          //         this.$notify.error({ title: '提示信息', message: '已大于剩余数量(' + row.lessCount + ')' || '操作失败!' });
          //         row.partCount = row.lessCount;
          //       }
          //       row.cmsClaimAmount = parseFloat(row.cmsClaimPrice * row.partCount).toFixed(2);
          //
          //     }else{
          //       this.$notify.error({ title: '提示信息', message: '数量不能为负数' || '操作失败!' });
          //       row.partCount =  0
          //     }
          //     this.changeCells();
          //   },
        },
        { title: '索赔单价', dataIndex: 'cmsClaimPrice', sorter: true },
        { title: '申请金额', dataIndex: 'cmsClaimAmount', sorter: true },
        { title: '是否特批', dataIndex: 'isSpecial', sorter: true },
        // { title: '备件代码', dataIndex: 'partId', hidden: true },
      ];
    },
    //换下件
    columnshuanxiajianFn() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          fixed: 'left',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '操作',
          dataIndex: 'column-action',
          width: 80,
          render: props => {
            if(getAppId()=='beijing'){
            return (
              <div style="text-align:center">
                <multiuse-button type="text" onClick={() => this.delsFunXj(props.row)}>
                  变更
                </multiuse-button>
                <multiuse-button type="text" disabled={!this.addFlag} onClick={() => this.delsFunXjf(props.row)}>
                  删除
                </multiuse-button>
              </div>
            );}
            else{
            return (
              <div style="text-align:center">
                <multiuse-button type="text" onClick={() => this.delsFunXjf(props.row)}>
                  删除
                </multiuse-button>
              </div>
            );
            }
          }
        },
        {
          title: '主因件',
          dataIndex: 'ifMain',
          sorter: true,
          editable: true,
          editType: 'checkbox',
          editItems: [
            { text: '', trueValue: 10041001 },
            { text: '', falseValue: 10041002 }
          ]
        },
                { title: '备件代码', dataIndex: 'partCode', sorter: true,
              render: props => {
              if(getAppId() == 'beijing'){
              return (
                <div style="text-align:center">
                <multiuse-button type="text" onClick={() => this.chuanvalue(props.row)}>
                  {props.row.partCode}
                </multiuse-button>
                </div>
              );
            } else{
              return(
                <div>
                {props.row.partCode}
                </div>
              )
            }
        }},
        { title: '备件名称', dataIndex: 'partName', sorter: true },
        { title: '变更前备件代码', dataIndex: 'partCodeBefore', sorter: true },
        { title: '变更前备件名称', dataIndex: 'partNameBefore', sorter: true },
        { title: '单位', dataIndex: 'partUnit', sorter: true },
        // { title: '剩余数量', dataIndex: 'lessCount', sorter: true },
        { title: '数量', dataIndex: 'partCount', sorter: true },
        { title: '备件回运类型', dataIndex: 'returnType', sorter: true, dictItems: this.createDictList('5585') },
        { title: '供应商', dataIndex: 'supName', sorter: true,   unitRender: p => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectSuppliersCode()} />
              </div>
            );
          } }
        // { title: '备件代码', dataIndex: 'partId', hidden: true },
      ];
    },
    //附加项目
    columnsfujiaxiangmuFn() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          fixed: 'left',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '操作',
          dataIndex: 'column-action',
          width: 130,
          render: props => {
            return (
              <div style="text-align:center">
                <multiuse-button type="text" onClick={() => this.editFile(props.row)}>
                  上传附件
                </multiuse-button>
                <el-divider direction="vertical" />
                <multiuse-button type="text" disabled={this.flag} onClick={() => this.delsFunFj(props.row)}>
                  删除
                </multiuse-button>
              </div>
            );
          }
        },
        { title: '附加项目代码', dataIndex: 'addCode', sorter: true },
        { title: '附加项目名称', dataIndex: 'addName', sorter: true },
        {
          title: '附加项目费用',
          dataIndex: 'addAmount',
          sorter: true,
          editable: true,
          editType: 'number',
          editValidator: (val, row, callback) => {
            if (row.addAmount < 0) {
              this.$notify.error({ title: '提示信息', message: '附加项目费用最小为0' });
              row.partCount = 0;
            }
            this.acData.addList.map(x => {
              if (x.addCode == row.addCode) {
                if (x.addAmount != row.addAmount) {
                  this.columnsfujiaxiangmu.find(x => x.dataIndex == 'remarks').editRequired = true;
                } else {
                  this.columnsfujiaxiangmu.find(x => x.dataIndex == 'remarks').editRequired = false;
                }
              }
            });
          }
        },
        { title: '备注', dataIndex: 'remarks', sorter: true, editable: true, editRequired: false, rules: [{ required: false, message: '请填备注', trigger: 'blur' }] }
      ];
    },
    //外出救援信息
    outformListFn() {
      return [
        {
          type: 'INPUT',
          label: '救援双边里程',
          fieldName: 'outMile',
          initialValue: 0,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '人数',
          fieldName: 'outPerson',
          initialValue: 0,
          readonly: true // 只读
        },
        {
          type: 'RANGE_DATE',
          label: '救援时间',
          fieldName: 'bDate|eDate',
          initialValue: 0,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '是否偏远地区',
          fieldName: 'isFar',
          initialValue: 0,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '外出路线',
          fieldName: 'outLine',
          initialValue: 0,
          readonly: true // 只读
        }
      ];
    },
    //外出救援费用
    outAmountformListFn() {
      return [
        {
          type: 'INPUT',
          label: '燃油补贴',
          fieldName: 'fuel',
          initialValue: 0,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '人员补贴',
          fieldName: 'pr',
          initialValue: 0,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '餐补',
          fieldName: 'food',
          initialValue: 0,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '住宿补贴',
          fieldName: 'stay',
          initialValue: 0,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '车船费',
          fieldName: 'cross',
          initialValue: 0,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '拖车费',
          fieldName: 'trailer',
          initialValue: '',
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '其他费用',
          fieldName: 'other',
          initialValue: '',
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '激励类型',
          fieldName: 'rewardType',
          initialValue: '',
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '奖励金额',
          fieldName: 'reward',
          initialValue: '',
          readonly: true // 只读
        }
      ];
    },
    //费用信息
    feiyongformListFn() {
      return [
        {
          type: 'INPUT',
          label: '合计费用',
          fieldName: 'sumAmount',
          initialValue: 0,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '工时费用',
          fieldName: 'labourAmount',
          initialValue: 0,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '备件费用',
          fieldName: 'partAmount',
          initialValue: 0,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '附加项目费用',
          fieldName: 'addAmount',
          initialValue: 0,
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '外出救援费用',
          fieldName: 'helpAmount',
          initialValue: 0,
          readonly: true // 只读
        },
        {
          type: 'BREAK_SPACE',
          label: '一口价区域',
          style: {}
        },
        {
          type: 'INPUT',
          label: '一口价费用',
          fieldName: 'priceAmount',
          initialValue: '',
          readonly: true // 只读
        }
      ];
    }
  }
};
</script>

<style lang="less" scoped></style>
